简体   繁体   中英

Testing html5 inputs in Android application by Robotium

At start i want to say sorry about my English skill. I write automated test for the hybrid Android application. GUI of this app is written in HTML5/JS/CSS3 (with angularJS framework). I want to test any data form. Form is filled with some data on the start (received from server). To enter new data I have to clear current value and enter the new one. For enter new text i use:

By element = By.cssSelector("...");
solo.waitForWebElement(element);
solo.typeTextInWebElement(element, "foo", 0);

and it works well. I have got problems with data clear. In the Robotium documentation i found method:

solo.clearTextInWebElement(item);

This method cannot get index parameter (I don't know why), it only use the "By" object to catch specified element. I decided to use code like:

By item = By.cssSelector("input:nth-child(3)");
this.solo.waitForWebElement(item);
this.solo.sleep(3000);
this.solo.clearTextInWebElement(item);

but still doesn't work too. I don't know how to test web inputs by Robotium.

If the web elements have name or id attributes then you can use By.id("elementId") or By.name("elementName") to access them.

Your question will be easier to answer if you post more sample code, particularly the html of the elements you're trying to test.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM