RobotiumTech / robotium

Android UI Testing
http://www.robotium.org
Apache License 2.0
2.86k stars 786 forks source link

Need method to switch to iframe context and access elements within it #726

Closed renas closed 9 years ago

renas commented 9 years ago

From rajesh.t...@gmail.com on January 01, 2015 17:29:50

1.What steps will reproduce the problem?

I have a webview which has an iframe content wrapped in a #document as below. Using Robotium, I'm unable to click or find elements within the iframe.

I'm using solo.clickOnWebElement(By.xpath("//div[@id='mydiv']")

  1. What is the expected output? What do you see instead?

I should be able to click on the elements within the iframe document. I get element not found if i refer any iframe document elements within my robotium code using xpath as above.
Similar to selenium, we need a method to switch to iframe document and perform actions and switch back to parent

3.What version of the product are you using? On what operating system?

Android 4.4 kitkat Robotium Solo 5.0.1

  1. Please provide any additional information below. When i look at how the log, i see that Robotium internally uses document.evaluate which has the document context as the parameter. If i set the document context to iframe manually as below, within chrome console, i was able to access the iframe elements

document.evaluate("//div", document.getElementById("iframe_a").contentDocument, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue

Original issue: http://code.google.com/p/robotium/issues/detail?id=647

renas commented 9 years ago

From rajesh.t...@gmail.com on January 10, 2015 04:45:31

I have fixed it locally

renas commented 9 years ago

From renasr...@gmail.com on February 02, 2015 09:10:38

Thanks for reporting this. Is the iframe_a id a general id for all iframes or could the name be something else?

Status: Accepted
Owner: renasr...@gmail.com

renas commented 9 years ago

From rajesh.t...@gmail.com on February 02, 2015 20:05:40

Thanks for your reaponse. Iframe_a is just the id my application uses. Usually in selenium we have methods to switch to a iframe by passing the iframe id . Requesting something similar in robotium.

renas commented 9 years ago

From renasr...@gmail.com on February 02, 2015 20:14:56

Ok thanks. We will add support for this in the next release.

renas commented 9 years ago

From rajesh.t...@gmail.com on April 28, 2015 14:55:55

May i know when this will be fixed in trunk?

renas commented 9 years ago

From renasr...@gmail.com on May 05, 2015 10:54:51

Please contact us at support@robotium.com and we'll send you a jar that includes this feature. Would be great if you can help us test it.

renas commented 9 years ago

From renasr...@gmail.com on May 26, 2015 18:40:05

This has been fixed in Robotium 5.4.1.

renas commented 9 years ago

From renasr...@gmail.com on May 26, 2015 18:40:15

Status: Verified

renas commented 9 years ago

From rajesh.t...@gmail.com on May 26, 2015 19:10:38

Thank you Renas !