Reputation: 73
I'm writing a script using Selenium's Python implementation. When the script reaches this line:
driver.find_element_by_id('ctl00_Top_EntryButton').click()
The page loads a modal dialog but the python script hangs on the command. I debugged it a little and it seems its stuck on a while loop in socket.py, I guess it's waiting for some input.
Does anyone have ideas on what's wrong?
EDIT
I'm adding some more code for clarity:
driver = webdriver.Firefox()
driver.get("https://www.somesite.com")
driver.switch_to_frame("mainIFrame")
driver.find_element_by_id('ctl00_Top_EntryButton').click()
Upvotes: 3
Views: 2930
Reputation: 21
This helped me:
from selenium.webdriver import DesiredCapabilities
capabilities = DesiredCapabilities.FIREFOX.copy()
capabilities['pageLoadStrategy'] = 'eager'
driver = webdriver.Firefox(capabilities=capabilities)
....click()
Upvotes: 0
Reputation: 809
It's possible that by the time your program gets to the .click() function, the webpage hasn't loaded yet, and thus the click function might not work properly. Try adding a time.sleep(10) line or so to your function right before the .click() line and see if that solves the problem.
Upvotes: 1