I am using Appium and selenium to automate this registration page https://www.gridlastic.com/register.php
public class GridlasticRegistrationPage extends BasePage {
@FindBy(xpath = "//android.widget.EditText[@text='First Name']") WebElement FIRST_NAME_TEXT_BOX;
@FindBy(xpath = "//android.widget.EditText[@text='Last Name']") WebElement LAST_NAME_TEXT_BOX;
public void navigateToGridlasticRegistrationPage(){
driver.get("https://www.gridlastic.com/register.php");
}
public void register(String fName, String lName){
waitForElement(FIRST_NAME_TEXT_BOX);
FIRST_NAME_TEXT_BOX.sendKeys(fName);
waitForElement(LAST_NAME_TEXT_BOX);
LAST_NAME_TEXT_BOX.sendKeys(lName);
GET_FREE_ACCOUNT_BUTTON.click();
}
}
But in this code, I am getting following error.
Failed Step: Register to Gridlastic using First Name, Last Name, Comapany, Work Email, Username and Password in the following table <table:/resources/gridlastic_registration_details.csv>
Specification: specs\GridlasticRegistration.spec:16
Error Message: org.openqa.selenium.TimeoutException: Timed out after 15 seconds waiting for element to be clickable: Proxy element for: org.openqa.selenium.support.pagefactory.DefaultElementLocator@fae9e82
Build info: version: '2.46.0', revision: '61506a4624b13675f24581e453592342b7485d71', time: '2015-06-04 10:22:50'
System info: host: 'Mitrai-OsandaN', ip: '192.168.88.2', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_121'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities [{deviceScreenSize=768x1280, networkConnectionEnabled=true, warnings={}, databaseEnabled=false, version=5.1.0, deviceName=192.168.88.101:5555, platform=ANDROID, deviceUDID=192.168.88.101:5555, desired={browserName=chrome, platformName=Android, version=5.1.0, deviceName=My phone, platform=ANDROID}, platformVersion=5.1, webStorageEnabled=false, locationContextEnabled=false, takesScreenshot=true, browserName=chrome, javascriptEnabled=true, deviceModel=Custom Phone - 5.1.0 - API 22 - 768x1280, platformName=Android, deviceManufacturer=unknown}]
Session ID: 4ec65f50-9746-4093-ae33-f0d1f735652f
Stacktrace:
org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:80)
org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:229)
Please help me to solve this issue. Even if I remove the "WebDriverWait wait", it says "No such element". I think issue is in the xpath. But I have tried with many xpaths, still get the same error.
Please note that I am using android chrome browser to automate this scenario.
Finally I found out the answer for this issue. I used android chrome browser widget's xpath for the element. It is wrong and the fix is that I have to use desktop browser's xpath as the following.
@FindBy(xpath = "//input[@name='fname']") WebElement FIRST_NAME_TEXT_BOX;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.