Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wait for element to load when testing an iOS app using Appium and Ruby?

Tags:

ios

ruby

appium

I am testing an iOS app, and can't interact with the elements after logging in because Appium is going too fast.

Can someone please point me to an example of using a WebDriverWait style of waiting for Appium iOS testing? Preferably in Ruby.

Thanks.

like image 961
Aaron Avatar asked Jul 18 '13 18:07

Aaron


People also ask

How do you use explicit wait in Appium?

In explicit wait, we tell the web driver instance to wait for a certain condition invoked through ExpectedConditions . So, this wait applies explicitly to the specified element. Explicit wait can be invoked using this code: WebDriverWait wait = new WebDriverWait(appiumDriver, 10);wait.

Does Appium support Ruby?

BrowserStack App Automate enables you to test native and hybrid mobile applications using Appium automation framework. Its easy to run your Appium tests written in Ruby on real Android and iOS devices on BrowserStack.

How do I check if an element is present in Appium?

//Selecting Element MobileElement pElement = (MobileElement) driver. findElementByAccessibilityId("SomeAccessibilityID"); //Checking if it displayed on screen. boolean isDisplayed = pElement.


2 Answers

This worked for me but I am new to Appium

#code that navigated to this page
wait = Selenium::WebDriver::Wait.new :timeout => 10
wait.until { @driver.find_element(:name, 'myElementName').displayed? }
#code that deals with myElementName
like image 153
user1919861 Avatar answered Oct 27 '22 00:10

user1919861


I use this construction to wait some element appears:

wait_true { exists { find_element(:xpath, path_to_element) } }

Of course, you can find not only by :xpath.

Also you can set timeout:

wait_true(timeout) { exists { find_element(:xpath, path_to_element) } }
like image 42
Dmitry Avatar answered Oct 27 '22 00:10

Dmitry