Source:FilterTabletsTest.java
...12import net.thucydides.core.annotations.Steps;13import net.thucydides.core.annotations.Story;14import net.thucydides.core.pages.Pages;15import net.thucydides.junit.runners.ThucydidesParameterizedRunner;16import net.thucydides.junit.runners.ThucydidesRunner;17import org.junit.After;18import org.junit.Before;19import org.junit.Test;20import org.junit.runner.RunWith;21import org.openqa.selenium.WebDriver;22/**23 * @author Anton_Ostrenko on 2014/12/28.24 */25@RunWith(ThucydidesRunner.class)26@Story(Application.YandexMarket.FilterTablets.class)27public class FilterTabletsTest extends BaseTest{28 private TabletFilter filter;29 @Before30 public void openTabletsCategory() {31 user.navigateTo();32 user.yandexMainPage.openMarket();33 user.marketMainPage.navigation.openCategory(NavigationBlock.Categories.TABLETS);34 }35 @Test36 public void filterTabletsByPriceAndScreenSize() {37 filter = TabletFilter.newBuilder("4500", "5000", new String[]{""}).setScreenSize(Filter.Conditions.EQUAL, "7").build();38 user.tabletsPage.search.inputPrice(filter.getPriceFrom(), filter.getPriceTo());39 user.tabletsPage.search.inputScreenSize(filter.getScreenSizeCondition(), filter.getScreenSize());...
1// This loops gracefully handles StateElementReference errors and retries up to 10 times. These can occur when an element, like a modal or notification, is no longer available.2export async function findByAndroidId( id, { assert = wd.asserters.isDisplayed, timeout = 10000, interval = 100 } = {} ) {3 MAX_ATTEMPTS = 10;4 let attempt = 0;56 while( attempt < MAX_ATTEMPTS ) {7 try {8 return await this.waitForElementById( `android:id/${ id }`, assert, timeout, interval );9 }10 catch ( error ) {11 if ( error.message.includes( "StaleElementReference" ) )12 attempt++;13 else14 throw error; // Re-throws the error so the test fails as normal if the assertion fails.15 }16 }17}18
Automation Testing Tutorials
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
LambdaTest Learning Hubs:
YouTube
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.