Skip to content
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

Send keys to authentication window doesn't work for chromdriver. #5137

Closed
lilit14 opened this issue Nov 29, 2017 · 5 comments
Closed

Send keys to authentication window doesn't work for chromdriver. #5137

lilit14 opened this issue Nov 29, 2017 · 5 comments

Comments

@lilit14
Copy link

lilit14 commented Nov 29, 2017

Meta -

OS: Windows 10
Selenium Version: 3.7.0
Browser: Chrome 62, chromediver 2.33
python 2.7

here is the code sample
1 wait(driver, 5).until(EC.alert_is_present())
2 alert = driver.switch_to_alert()
3 alert.send_keys("username" + Keys.TAB + "password")
4 alert.accept()

Expected Behavior - send username and password to popup and apply. This works as expected with firefox.

Actual Behavior -

I'm getting timeout exception on line 1 - selenium.common.exceptions.TimeoutException: Message:
but actually the alert is present.
chromeauthenticationrequired

when removing line 1, I'm getting exception on line 2
selenium.common.exceptions.NoAlertPresentException: Message: no alert open

@barancev
Copy link
Member

Drivers will implement this feature not earlier than it is specified in W3C WebDriver standard.
Follow this issue for the status: w3c/webdriver#385

@hujog
Copy link

hujog commented Dec 3, 2017

workaround that worked for me:
Authenticate via the URL
https://username:[email protected]

OS: Linux Mint 17.3
Selenium Version: 3.7.0
Browser: Chrome 62.0.3202.94, chromediver 2.32
python 3.4.3

@lilit14
Copy link
Author

lilit14 commented Dec 4, 2017

Thanks, the workaround works for me as well.

@gauravk97
Copy link

If even this doesn't work, then one change that you can try is

alert.send_keys("username" + Keys.TAB.toString() + "password")
in the third command

@arunkrh
Copy link

arunkrh commented Mar 10, 2019

I am not able to login to the site using Alert.send_keys()
My System configuration:
OS: Windows10 64bit
Browser Version: 72.0.3
Selenium: 3.141
Python: 3.7
Chrome Driver: 72.0.3

Code tried:1
+++++++++++
browser = webdriver.Chrome()
browser.get('http://10.179.230.232/desktop/')

alert = Alert(browser)
alert.send_keys("apc"+str(Keys.TAB)+"apc")
alert.accept()
++++++++
Code Tried: 2
++++++++
browser = webdriver.Chrome()
browser.get('http://10.179.230.232/desktop/')

Alert.send_keys("apc")
browser.switch_to.alert()
Alert.send_keys("apc")
+++++++++
Error:
Traceback (most recent call last):
File "C:/DataVerificationSQA/UITest/dceUITest.py", line 47, in
alert.send_keys("apc"+str(Keys.TAB)+"apc")
File "C:\Program Files\Python37\lib\site-packages\selenium\webdriver\common\alert.py", line 105, in send_keys
self.driver.execute(Command.SET_ALERT_VALUE, {'text': keysToSend})
File "C:\Program Files\Python37\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "C:\Program Files\Python37\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoAlertPresentException: Message: no such alert
(Session info: chrome=72.0.3626.121)
(Driver info: chromedriver=72.0.3626.69 (3c16f8a135abc0d4da2dff33804db79b849a7c38),platform=Windows NT 10.0.14393 x86_64)

__

git

Firefox is working fine.
++++++++++
browser = webdriver.Firefox()
browser.get(r'http://10.179.230.232/desktop/')
alert = Alert(browser)
alert.send_keys(f'apc{Keys.TAB}apc')
alert.accept()
++++++++++++

Please help me to solve this issue.
Thanks

@lock lock bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants