-1

I have an application that generates a new browser tab when I click on a link. In the new tab I get the Chrome authentication alert. I've tried using the below code:

    wd.switch_to_window(wd.window_handles[1])
    a = switch_to_alert()
    a.send_keys('username' + Keys.TAB + 'password')

but I get the no alert error msg

I have also tried using the ActionChain to send the keys but the alert does not receive the send_keys

Are there any alternatives? fyi I cannot use https://username@password format as this tab is generated when I click on a link

Traceback

Vivian Yung
  • 79
  • 1
  • 9

1 Answers1

0

I suppose you mean that a link opens a new tab which has username and password fields which you input them with ‘username’ and ‘password’ respectively? If that is the case can you on the newly opened tab first search for the elements (username and password) using an explicit wait,and only then enter values.

I had a similar issue where my web driver was stuck on the earlier page and tried inputting values into fields which didn’t exist there. Try typing your active tab’s title to confirm that’s not the case.

Siddharth Sonone
  • 662
  • 2
  • 7
  • 13
  • its an alert and not a html element I've also switch the window handle and the tab with the authentication alert is in focus, for example: http://cdn.freshdesk.com/data/helpdesk/attachments/production/4003603482/original/image001_png.png?1403051811 – Vivian Yung Oct 17 '17 at 20:50
  • Oh the modal isn’t getting detected have a look at this one https://stackoverflow.com/q/17676036/5912110 apologies if this want helpful – Siddharth Sonone Oct 17 '17 at 20:55