With the use of selenium and python I am trying to develop automated web/GUI tests for sharepoint pages. The issue I have is the authentication, which is presented in form of a window/popup/alert/I_dont_know as follows
In the code I have tried the following combinations (based on this suggestion):
profile = webdriver.FirefoxProfile()
authDomains = "http://bfh.col.garaio.ch"
profile.set_preference("network.automatic-ntlm-auth.trusted-uris", authDomains)
driver = webdriver.Firefox(firefox_profile=profile)
driver.implicitly_wait(30)
driver.get("http://bfh.col.garaio.ch/_layouts/closeconnection.aspx?loginasanotheruser=true")
alert = driver.switch_to.alert()
#alert = driver.switch_to.window(driver.window_handles[0])
alert.send_keys('USERNAME')
alert.send_keys(Keys.TAB)
alert.send_keys('PASSWORD')
alert.accept()
I tried windows and alert, but in the alert-case nothing happens, and in the window case I get an error:
AttributeError: 'NoneType' object has no attribute 'send_keys'
probably there is no window in driver.window_handles..
How can I fix this in order to send the username and the password to that box? It should for for firefox, chrome and IE as I intend to use selenium for functional testing of those sharepoint pages. For that reason, I need to log in as different users to be able to test permissions...
Addition:
- The code execution seems to hang in this line:
alert = driver.switch_to_alert()
