I am trying to automate some test case using Python Selenium Webdriver. I click on a button which opens up a new window/iframe/popup. Which needs some data to be be added in text box and choose some from the drop box. I have two questions,
- How would I find if its a window/iframe/popup from the firepath in Mozilla?
- How to get the handle?
This is the xpath and content I see in firepath when I select the new window/iframe/popup(image attached),
html/body/div[11]
I have the code here,
zenoss_url = "http://xxxxx/"
xpath_uname = "html/body/form/div/div/input[1]"
xpath_pwd = "html/body/form/div/div/input[2]"
xpath_submitButton = "html/body/form/div/div/input[3]"
xpath_eventsTab = "html/body/div[7]/div/div/div/div[2]/ul/li[2]/div/div/a"
driver = webdriver.Firefox()
driver.get(zenoss_url)
handle = driver.find_element_by_xpath(xpath_uname)
handle.send_keys(zenoss_uname)
handle = driver.find_element_by_xpath(xpath_pwd)
handle.send_keys(zenoss_pwd)
driver.find_element_by_xpath(xpath_submitButton).submit()
driver.implicitly_wait(10)
driver.find_element_by_xpath("html/body/div[7]/div/div/div/div[2]/ul/li[2]/div/div/a").click()
driver.find_element_by_xpath("html/body/div[3]/div/div/div/div[1]/div/div/div[1]/div/div/div[7]/em/button").click()
driver.implicitly_wait(5)
window = driver.switch_to_window(?????)
I am not sure what "name" i should replace with ?????
Appreciate any help.