Hello, I'm in need of help. Are there any other si...
# prefect-community
l
Hello, I'm in need of help. Are there any other similar and simpler alternatives than selenium that I can use in prefect? From what I'm seeing, selenium is going to end up giving me a lot of work to implement. I just wanted to know if there are any alternatives to selenium that I can use in prefect.
1
k
What are you using selenium to accomplish?
l
I wanted to make an algorithm that logs into my Google account and takes a token.
k
depending on what steps are required, you may be able to use python's
requests
package
l
I tried already, but I didn't succeed I used this script here:
Copy code
from bs4 import BeautifulSoup
import requests

my_email = "email"  # my email is here
my_pass = "password"  # my password is here

url = "<https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=105273681273-sbo8hk12smk1uh2jgii9v09i4kf1ns24.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fadwords&state=MyEVvIsAytjJjqXvqeOyUA1ZjiJF4R&prompt=consent&access_type=offline>"

form_data = {'Email': my_email, 'Passwd': my_pass}
post = "<https://accounts.google.com/signin/challenge/sl/password>"

with requests.Session() as s:
    soup = BeautifulSoup(s.get("<https://mail.google.com>").text, "html.parser")
    for inp in soup.select("#gaia_loginform input[name]"):
        if inp["name"] not in form_data:
            form_data[inp["name"]] = inp["value"]
    s.post(post, form_data)
    html = s.get("<https://mail.google.com/mail/u/0/#inbox>").content

    # Prints 'False', should print 'True'
    print(my_email in s.get('<https://mail.google.com/mail/u/0/#inbox').text)>
And it's not just logging in, you have to navigate some options until the token appears