I have a registration page that takes details from the user like contact details and address details.On click of register button, a bootstrap modal is opened which has buttons like close,try,etc. I want to access these buttons. I have tried switching handles but I am getting only one handle ie the main handle. The code for webdriver looks like this :
main_window_handle = driver.current_window_handle
print main_window_handle
driver.find_element_by_id("ctl00__mainContent_ucObjRegister_btnRegister").click()
signin_window_handle = None
while not signin_window_handle:
for handle in driver.window_handles:
if handle != main_window_handle:
signin_window_handle = handle
break
print main_window_handle
print signin_window_handle
driver.find_element_by_id("ctl00__mainContent_ucObjRegister_ucObjAddressVerification_btnCancel").click()
The btnCancel is present on the modal which doesn't get clicked.And the above loop goes into infinite loop.