New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getAttribute for class name of a WebElement throws NoSuchElementException #355
Comments
Hmm... It is interesting. I'll open an issue here: https://github.com/appium/appium |
@namannigam
I'm waiting for your response and then I'm closing this issue. You can close it on your own. |
@TikhomirovSergey 👍 it works, Please correct me if I am wrong, I believe just the doc for WebElement is a bit mis-leading in this case. Thanks. Lets close this with one final comment over the doc. |
I think that some Selenium attributes (html tags) are not convenient to native app automation. This thing should be documented. |
Description
Using getAttribute for class name of a WebElement throws NoSuchElementException even when the element exists on the screen.
Environment
Details
http://stackoverflow.com/questions/36478130/using-getattribute-to-get-the-class-name-of-a-webelement
Went through the java docs of getAttribute. Couldn't understand the point mentioned as :
Couldn't understand if webElement.getAttribute("class") shall return the class name of the element or not?
Code To Reproduce Issue [ Good To Have ]
WebElement webElement = <findElement using some locator strategy>; System.out.println("element " + webElement.getAttribute("class"));
Exception stacktraces
org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 13 milliseconds
Link to Appium logs
Pushing command to appium work queue: ["element:getAttribute",{"elementId":"2","attribute":"class"}]
2016-04-07 14:19:08:721 - info: [debug] Responding to client with error: {"status":7,"value":{"message":"An element could not be located on the page using the given search parameters.","origValue":"This element does not have the 'class' attribute"},"sessionId":"9fd3b49c-5495-48c0-a2b3-a62c7bb44b98"}
2016-04-07 14:19:08:723 - info: <-- GET /wd/hub/session/9fd3b49c-5495-48c0-a2b3-a62c7bb44b98/element/2/attribute/class 500 9.562 ms - 227
2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getAttribute","params":{"elementId":"2","attribute":"class"}}
2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Got command action: getAttribute
2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":7,"value":"This element does not have the 'class' attribute"}
The text was updated successfully, but these errors were encountered: