python wait till element is seen doesn't appear to be working.

1,018 views
Skip to first unread message

Simon Howlett

unread,
May 1, 2013, 10:07:58 PM5/1/13
to appium-...@googlegroups.com
apologies for the simple nature of the question.

I have some tests that wait until either a screen is loaded (mobile safari) or until a specified length of time (native ioS), these tests were previously working, but now it seems like the wait is being ignored. I am assuming i should either have a preference set in the UI that i dont, or run node with an argument..


the simplest versions being (for the safari example, apologies for the crappy code..);

import unittest
import os
import time
from selenium import webdriver
import selenium.webdriver.support.ui as ui

class TestSequenceFunctions(unittest.TestCase):

    def setUp(self):
        # set up appium
        self.driver = webdriver.Remote(
            command_executor='http://127.0.0.1:4723/wd/hub',
            desired_capabilities={
                'browserName': 'iOS',
                'device':'iPad',
                'platform': 'Mac',
                'version': '6.1',
                'app': 'Safari',
            })

    def test_ui_items(self):
        self.driver.get('http://webfilings.com') #open url
        #onelogin sign in
        wait = ui.WebDriverWait(self.driver,8)
        wait.until(lambda driver: self.driver.title.startswith('xxxx'))
        self.driver.find_element_by_link_text('WDesk').click()

I am getting a NoSuchElement exception at the point in time the WDesk link should be loaded. 

Traceback (most recent call last):
  File "test_webfilings.py", line 30, in test_ui_items
    self.driver.find_element_by_link_text('WDesk').click()
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in find_element_by_link_text
    return self.find_element(by=By.LINK_TEXT, value=link_text)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 675, in find_element
    {'using': by, 'value': value})['value']
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 160, in execute
    self.error_handler.check_response(response)
  File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 149, in check_response
    raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: u'An element could not be located on the page using the given search parameters.' 


Jonathan Lipps

unread,
May 2, 2013, 1:05:37 AM5/2/13
to Simon Howlett, appium-...@googlegroups.com
What happens if you set an implicit wait as well, say 10s?

--
http://appium.io
---
You received this message because you are subscribed to the Google Groups "Appium-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to appium-discus...@googlegroups.com.
Visit this group at http://groups.google.com/group/appium-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Simon Howlett

unread,
May 2, 2013, 11:56:18 AM5/2/13
to appium-...@googlegroups.com, Simon Howlett
seems to work for my safari tests, now attempting similar for my native tests.. any thoughts on why that suddenly stopped being sufficient? user error probably ;)

liwa...@gmail.com

unread,
May 7, 2014, 11:50:50 PM5/7/14
to appium-...@googlegroups.com, Simon Howlett
Hi Simon,

I'm now running into a similar problem, do you mind sharing how to do the wait in native app? and what library you import? Thanks!
Reply all
Reply to author
Forward
0 new messages