Re: [robotium-developers] clickOnWebElement() doesn't work

157 views
Skip to first unread message

Renas

unread,
May 29, 2013, 6:13:05 AM5/29/13
to robotium-...@googlegroups.com
Please submit this issue in the issue tracker.


/Renas


On Wed, May 29, 2013 at 12:10 PM, Tim <karthi...@googlemail.com> wrote:
I have pasted my code snippet and webview part here. In my test code clickOnWebElement doesn't click the desired element on screen. Can anybody assist me what is going wrong?


The web html code is 

<div id="history" class="tab"></div>

This is my test code snippet

WebElement wb = solo.getWebElement(By.id("history"), 0);
System.out.println("ClassName: " + wb.getClassName()); // ------------------------------------> This line prints classname as "tag" in logcat
System.out.println("Location: " + wb.getLocationX() + " Y is " +wb.getLocationY()); // ------------------------------------> This line prints the X, Y position of the webelement
solo.clickOnWebElement(wb); // This click doesn't work


Even i tried the below appraoch, but no success.

WebView web;
for (View view : screen.getCurrentViews()) {
if (view instanceof WebView) {
web = (WebView) view; 
web.getSettings().setJavaScriptEnabled(true);
screen.sleep(5000);
web.getSettings().setAllowContentAccess(true);
web.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
web.loadUrl("javascript:alert(ids.history)"); // This ids.history object is nothing but document.getElementById("history"). This prints objectHTMLElement
web.loadUrl("javascript:ids.history.click();"); // Even at this approach click doesn't function.
}
}



--------------------

I just had a lok at the HTML page content. All the <script> tag content are directly embedded within <body> and not in <head> tag due to performance issues. 

Hope that doesnt make any difference. When alert can display "objectHTML..Element", i am not sure why click() event is not getting triggered.




--
You received this message because you are subscribed to the Google Groups "Robotium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotium-develo...@googlegroups.com.
To post to this group, send email to robotium-...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotium-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

WeiLing Chang

unread,
Mar 17, 2015, 9:05:03 AM3/17/15
to robotium-...@googlegroups.com
Hi, I have the same problem as you. 
Do you have the answer of this problem?
Thanks

Tim於 2013年5月29日星期三 UTC+8下午6時10分33秒寫道:
Reply all
Reply to author
Forward
0 new messages