0

I am currently attempting to submit a form using selenium driver through python 2.7.12 and then retrieving the loaded page. The code i currently does not seem to wait for the page load this is the code i have:

while False:
    try:
        driver.find_element_by_id("ctl00_lblStockName") #oldpage id
        break
    except StaleElementReferenceException:
        continue

print ("Page is ready!")
f = driver.page_source
soup = BeautifulSoup(f,'html.parser')
print (soup)

The code above just prints the html of the page before the search. I'm unsure whether my while loop is working.

I have attempted another method using the timeout function but the error comes up as

AttributeError: 'WebDriver' object has no attribute 'manage'

Also I have read that using timeout is not especially reliable either, so I would like to avoid this method unless it's the only option.

1
  • Can you share page url Commented Nov 14, 2016 at 0:48

2 Answers 2

1

Kindly check your code driver.manage() is being called remove the function call look for the alternative in python bindings (http://selenium-python.readthedocs.io/api.html).

driver.manage(). is in Java Bindings of Selenium not in Python Bindings.

Sign up to request clarification or add additional context in comments.

2 Comments

so what's the one we can use in python??
driver.implicitly_wait(int secs)
0

To anyone still looking for the Python solution:

set_page_load_timeout(*time in seconds*)

e.g.

driver.set_page_load_timeout(20)     #waits for a page to load within 20 seconds before Selenium throws out Timeout exception

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.