-1
這是該網站的新手,仍然試圖解決問題的問題。什麼是在我的Appium代碼中使用的良好的IF語句
UPDATE 好了,所以做一些改變我的代碼後,我現在已經在我的代碼這個if語句,但我的問題是,如果IF語句爲真則繼續執行,某些頁面但卻不會點擊在按鈕上。我的代碼是否正確或缺少某些部分?
driver.findElement(By.id(redButton)).click();
driver.findElement(By.id(good)).click();
driver.findElement(By.id(locator)).click();
//IF statement with variable named "viewdets"
//If "View Details & Pay" button pops up click
if (!driver.findElements(By.id(viewdets)).isEmpty()) {
driver.findElement(By.id(viewdets)).click();
//App Closes and Doesn't Click Pay Button
driver.findElement(By.id(pay)).click();
driver.findElement(By.id(conpay)).click();
//If not then continue to stall and 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();
問題是什麼? – AntonH
@AntonH更新。仍然試圖在本網站上提問。 –
嘗試閱讀https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/是的,它很長,但非常好的內容。 – AntonH