I'm trying to open up a link that looks like this
I'm using Selenium, Python and after configuring the drive I try to open the link using the following structure:
https://username:[email protected]/otcs/llisapi.dll?func=ll&objId=120499404&objAction=browse&viewType=1
but it doesn't work.
I would appreciate any suggestions, thank you.
CodePudding user response:
var alert = driver.SwitchTo().Alert()
alert.SetAuthenticationCredentials("username", "password")
alert.Accept()
CodePudding user response:
When a new window pops up you have to handle this in Selenium.
web = webdriver.Firefox()
web.get('URL OF PAGE')
# DEFINE MAIN PAGE WINDOW:
main_page = web.current_window_handle
#SWITCH WINDOW TO NEW POPUP PAGE
for handle in web.window_handles:
if handle != main_page:
popup_page = handle
web.switch_to.window(popup_page)
See: https://selenium-python.readthedocs.io/navigating.html
Then you can use Selenium to send_keys("Username")
and send_keys("Password")
for example.