Search code examples
pythonseleniumselenium-webdriversst

SST Python not waiting for page to load


I have set set_wait_timeout(60.0) and use the wait_for in my code; however, the code is moving too fast and not allowing for the page to load, even with using add_timestamp=True. Is there any other way to get the code to wait longer for the page to load before moving to the next step? Below is my code:

__author__ = 'Brenda'

import unittest
from sst.actions import 
from sst import config

run_test('valid-login')
set_wait_timeout(60.0)
assert_link(get_element(text='View My Start Page'))
click_element(get_element(text='View My Start Page'),wait=True)
wait_for
take_screenshot('my-startpage.png',add_timestamp=True)
simulate_keys('white_border','BACK_SPACE')
wait_for(get_element(text='View My Start Page'))
assert_link(get_element(text='Make a Blog Entry'))

if __name__ == '__main__':
unittest.main()

My expectation was that a wait_for would allow the page to load before moving to the next step. Any help on this? Thanks!

Below is the traceback for the error: enter image description here


Solution

  • _author__ = 'Brenda'
    
    import unittest
    from sst.actions import
    from sst import config
    
    run_test('valid-login')
    set_wait_timeout(60.0)
    assert_link(get_element(text='View My Start Page'))
    click_element(get_element(text='View My Start Page'),wait=True)
    wait_for(assert_title, 'new page title')
    take_screenshot('my-startpage.png',add_timestamp=True)
    simulate_keys('white_border','BACK_SPACE')
    wait_for(assert_title, 'new page after navigation')
    assert_link(get_element(text='Make a Blog Entry'))
    
    if __name__ == '__main__':
    unittest.main()