java - What is a good IF statement to use in my Appium code -


new site , still trying hang of asking questions.

update ok after making changes code have if statement in code, problem if if statement true proceeds page won't click on button. code correct or missing parts?

    driver.findelement(by.id(redbutton)).click();      driver.findelement(by.id(good)).click();      driver.findelement(by.id(locator)).click();      //if statement variable named "viewdets"     //if "view details & pay" button pops click     if (!driver.findelements(by.id(viewdets)).isempty()) {         driver.findelement(by.id(viewdets)).click();         //app closes , doesn't click pay button         driver.findelement(by.id(pay)).click();         driver.findelement(by.id(conpay)).click();     //if not continue stall , check in     } else {         thread.sleep(7000);         driver.findelement(by.id(stall)).click();         driver.findelement(by.id(two)).click();         driver.findelement(by.id(three)).click();         driver.findelement(by.id(next)).click();          wait = new webdriverwait(driver, 15);         wait.until(expectedconditions.elementtobeclickable(by.id(pay)));          driver.findelement(by.id(pay)).click();         driver.findelement(by.id(conpay)).click();         driver.findelement(by.id(receipt)).click(); 

you can assert next expected element present on screen or not.

assuming previous 2 clicks("view details & pay" button) if successful lead screen or else not.

org.junit.assert.assertfalse(driver.findelements(by.id(good)).isempty()); 

validate there exists element id in page have navigated to. , perform action on as:

driver.findelement(by.id(good)).click(); 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -