• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

change window with Selenium

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I need to scrap some web page but before I need to do some actions in order to get to it.
I am filling some fields and clicking on a search button and moving to another window.
but the Chrome web driver is still pointing on the previous window. as you can see I am printing the handle windows of the driver before the click and after and I see only one window in the list.
this window is the previous one.

why I see only one?
how can I fix it and that the driver will point on the new one?

my current code :

from selenium import webdriver
browser = webdriver.chrome()
browser.get('https://a836-acris.nyc.gov/DS/DocumentSearch/PartyName')
firstName = browser.find_element_by_name("edt_first")
LastName = browser.find_element_by_name("edt_last")
firstName.send_keys("John")
LastName.send_keys("Smith")
print ('--------------------------------------------------------------------------------------------')
print (browser.window_handles)
browser.find_element_by_name("Submit").click()
print (browser.window_handles)


Thanks
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic