Issue
I am at my wits end.
I know how to log in with Selenium. But I do not succeed in logging in to a publish-dev-Site to test. The browser itself asks me to login before even redirecting me to the site. Because of this I cannot read an XPath, CSS, NAME/ there is no XPATH, CSS, NAME. What am I missing/ do not know?
This is the code:
from selenium import webdriver
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
options.add_argument("--incognito")
driver = webdriver.Chrome(options=options)
driver.get("xyz")
sign_in_username_input = driver.find_element(By.NAME, "Username")
sign_in_password_input = driver.find_element(By.NAME, "Password")
sign_in_username_input.send_keys("ABC")
sign_in_password_input.send_keys("DEF")
sign_in_login_button = driver.find_element(By.NAME, "Sign in")
sign_in_login_button.click()
And here's a pic:
Solution
Try passing credentials in the URL, see if that works.
Syntax: https://<username>:<password>@<domain>
Check the code below:
url = "http://username:[email protected]"
driver.get(url)
Answered By - Shawn
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.