I can log in to moz.com
without any problems with my default Windows browser (Chrome), but I can not log in with the Chrome driver. Is there any problem with the following code snippet?
from selenium import webdriver
from selenium.webdriver.common.by import By
driver = webdriver.Chrome()
# login to MOZ
username = "my email"
password = "my pass"
# head to github login page
driver.get("https://moz.com/login")
# find username/email field and send the username itself to the input field
driver.find_element(By.NAME,"email").send_keys(username)
# find password input field and insert password as well
driver.find_element(By.NAME,"password").send_keys(password)
# click login button
driver.find_element(By.XPATH,'//input[@class="forge-btn forge-btn-yellow"]').click()
The website has security measures. You can add extra options to your webdriver to avoid that or you can use undetected chrome.
First, install undetected chrome:
Then you can use it as follows:
For more, you can see: https://github.com/ultrafunkamsterdam/undetected-chromedriver