-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't log in because of cookies #48
Comments
After changing the log in logic with the following code:
I get this new error:
|
Managed to make it login like this
|
The cookie-issue was solved for me by using a vpn with the US as location, since they dont have this request. Not the most beautiful solution but it worked. |
Here is what I did Change x_path_text_cookies and x_path_text_login data to match your language (mine is for polish). def _login(browser, email, password):
browser.get("http://facebook.com")
browser.maximize_window()
browser.find_element_by_name("email").send_keys(email)
browser.find_element_by_name("pass").send_keys(password)
x_path_text_cookies = '//*[@title="Akceptuj wszystkie"]'
x_path_text_login = '//*[@name="login"]'
browser.find_element_by_xpath(x_path_text_cookies).click()
browser.find_element_by_xpath(x_path_text_login).click()
time.sleep(5) |
It should work now |
for me it worked substituting the _login with the following: note that "consenti solo coockie essenziali" should be changed with "allow only essential cookies" for english versions. from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
def _login(browser, email, password):
browser.get("http://facebook.com")
browser.maximize_window()
browser.implicitly_wait(5)
WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, "//button[contains(string(), 'Consenti solo i cookie essenziali')]"))).click()
time.sleep(5)
browser.find_element(By.NAME, "email").send_keys(email)
browser.find_element(By.NAME, "pass").send_keys(password)
browser.find_element(By.NAME, "login").click()
time.sleep(5) |
Sadly the elegant solution by @ferrazzipietro seems not to work.
|
@mikhail-poda seems like you are still using find_element_by_name(), that is no longer the choice for webdriver. As far as I know, you should use find_element() and then specify by what, as I did in the snippet I posted. |
Thank you @ferrazzipietro, it was my mistake - I had to close the py file in Notepad++ (saving the py file was not enough) so that the python runtime had the new py file version. After successful login and opening the group the chrome window disappears with the message
|
When running the script, I get:
The browser shows the allow cookie window. Is there any solution?
The text was updated successfully, but these errors were encountered: