xiaofans / robotium

Automatically exported from code.google.com/p/robotium
0 stars 0 forks source link

solo.clickOnWebElement() does not work - related to issue 409 #419

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

About issue 409, it is set as "invalid", sorry, I still think that is a defect. 
I left comments at the end of issue 409:

I changed my test code to this:

public void testSample() throws Exception {
    By byKitchensink = By.xpath("//a[./img[@src='kitchensink/resources/icons/icon.png']]");

    long t0 = System.currentTimeMillis();
    solo.waitForWebElement(byKitchensink, 60000, false);
    long t1 = System.currentTimeMillis();
    Log.d(getName(), "Waited " + (t1 - t0) + " ms for byKitchensink");

    solo.clickOnWebElement(byKitchensink, 0, false);
    Log.d(getName(), "Clicked Kitchensink");
    By byUserInterface = By.xpath("//div[./span[text()='User Interface']]");

    t0 = System.currentTimeMillis();
    solo.waitForWebElement(byUserInterface, 60000, false);
    t1 = System.currentTimeMillis();
    Log.d(getName(), "Waited " + (t1 - t0) + " ms for byUserInterface");

    solo.clickOnWebElement(byUserInterface, 0, false);
}

I got the log message:
    Waited 2174 ms for byKitchensink
    Waited 60315 ms for byUserInterface

So, it shows the xpath is found, and, code 
"solo.clickOnWebElement(byKitchensink, 0, false);" passed, it also shows the 
xpath is found.

If the xpath is not found, "solo.clickOnWebElement(byKitchensink, 0, false);" 
will throw exception, but, it did not.
The exception is thrown from the last row: 
"solo.clickOnWebElement(byUserInterface, 0, false);".

So, I do not think this issue is caused that the first xpath is not found.

How do you think of that?

Thank you very much!

Original issue reported on code.google.com by bolt...@gmail.com on 18 Mar 2013 at 2:34

GoogleCodeExporter commented 9 years ago
It seems as if it does find the xpath and does click it. However it does not 
click on the element you expect it to (I think it clicks on the log at the top 
left corner). Please use the xpath I sent you. 

Original comment by renasr...@gmail.com on 18 Mar 2013 at 11:55

GoogleCodeExporter commented 9 years ago
Hi there,

I did try the xpath and By.textContent("Kitchen Sink") you gave me, it does
not work either.

So, I am doubting whether my android version caused this? I am using
Android 4.2.2. Is it supported?

Thank you very much!

Original comment by bolt...@gmail.com on 19 Mar 2013 at 6:54

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
This works for me:

solo.waitForText("Kitchen Sink");
By byKitchensink = By.xpath("/html/body/div/section/ul/li/a/img");
solo.waitForWebElement(byKitchensink, 60000, false);
solo.clickOnWebElement(byKitchensink, 0, false);        

Original comment by renasr...@gmail.com on 19 Mar 2013 at 7:29