0

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

Brenda
  • 247
  • 1
  • 4
  • 14
  • Please do not convert text into a graphic - it makes it invisible to search engines, and therefore less like to get indexed properly. – SiKing Dec 09 '14 at 17:01
  • It won't let me copy and paste it and instead of typing it out, I made it into a graphic. I apologize, but that was my only option. – Brenda Dec 09 '14 at 17:02
  • See this: https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/windows_dos_copy.mspx – SiKing Dec 09 '14 at 17:16

1 Answers1

1
_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()
Saifur
  • 16,081
  • 6
  • 49
  • 73
  • Can you give me an example of how that would actually look? My text elements don't have any id's. I'm sorry if I'm sounding naive on this, but I've only been working with Selenium for a month now. – Brenda Dec 09 '14 at 18:12
  • I changed my statement to `wait_for(get_text(get_elements_by_css('#intro_w > div.welcome')),'Welcome ')` and now I receive the error message `AssertionError: Element with id: [] does not exist. – Brenda Dec 09 '14 at 18:22
  • Can you please tell me which line this is failing on? – Saifur Dec 09 '14 at 18:30
  • Line 906 in sst\actions.py – Brenda Dec 09 '14 at 18:32
  • Sorry Brenda not sure which line is that on your test code. Your test does not contain line number – Saifur Dec 09 '14 at 18:34
  • Sorry. It fails on line 10, which is `wait_for(get_text(get_elements_by_css('#quick_c_ul > li:nth-child(1) > a')),'View My Start Page')` – Brenda Dec 09 '14 at 18:40
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66507/discussion-between-saifur-and-brenda). – Saifur Dec 09 '14 at 18:43