{"action":"created","issue":{"url":"https://api.github.com/repos/appium/java-client/issues/355","repository_url":"https://api.github.com/repos/appium/java-client","labels_url":"https://api.github.com/repos/appium/java-client/issues/355/labels{/name}","comments_url":"https://api.github.com/repos/appium/java-client/issues/355/comments","events_url":"https://api.github.com/repos/appium/java-client/issues/355/events","html_url":"https://github.com/appium/java-client/issues/355","id":146640759,"number":355,"title":"getAttribute for class name of a WebElement throws NoSuchElementException","user":{"login":"namannigam","id":5231778,"avatar_url":"https://avatars.githubusercontent.com/u/5231778?v=3","gravatar_id":"","url":"https://api.github.com/users/namannigam","html_url":"https://github.com/namannigam","followers_url":"https://api.github.com/users/namannigam/followers","following_url":"https://api.github.com/users/namannigam/following{/other_user}","gists_url":"https://api.github.com/users/namannigam/gists{/gist_id}","starred_url":"https://api.github.com/users/namannigam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/namannigam/subscriptions","organizations_url":"https://api.github.com/users/namannigam/orgs","repos_url":"https://api.github.com/users/namannigam/repos","events_url":"https://api.github.com/users/namannigam/events{/privacy}","received_events_url":"https://api.github.com/users/namannigam/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/appium/java-client/labels/wontfix","name":"wontfix","color":"ffffff"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-07T14:20:49Z","updated_at":"2016-04-07T15:31:55Z","closed_at":null,"body":"## Description\r\n\r\nUsing getAttribute for class name of a WebElement throws NoSuchElementException even when the element exists on the screen.\r\n\r\n## Environment\r\n* java client build version or git revision if you use some shapshot: 3.4.0\r\n* Appium server version : Version 1.4.13 (Draco)\r\n* Mobile platform/version under test: Android\r\n* Real device or emulator/simulator: Emulator && Real Device\r\n* Driver : AppiumDriver\r\n\r\n## Details\r\n\r\nhttp://stackoverflow.com/questions/36478130/using-getattribute-to-get-the-class-name-of-a-webelement\r\n\r\nWent through the java docs of getAttribute. Couldn't understand the point mentioned as :\r\n\r\n> Finally, the following commonly mis-capitalized attribute/property names are evaluated as expected: \"class\" \"readonly\"\r\n\r\nCouldn't understand if webElement.getAttribute(\"class\") shall return the class name of the element or not?\r\n\r\n## Code To Reproduce Issue [ Good To Have ]\r\n\r\n`WebElement webElement = <findElement using some locator strategy>;\r\nSystem.out.println(\"element \" + webElement.getAttribute(\"class\")); `\r\n\r\n## Exception stacktraces\r\n\r\norg.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)\r\nCommand duration or timeout: 13 milliseconds\r\n\r\n## Link to Appium logs\r\n\r\nPushing command to appium work queue: [\"element:getAttribute\",{\"elementId\":\"2\",\"attribute\":\"class\"}]\r\n2016-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\"}\r\n2016-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 \r\n2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Got data from client: {\"cmd\":\"action\",\"action\":\"element:getAttribute\",\"params\":{\"elementId\":\"2\",\"attribute\":\"class\"}}\r\n2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION\r\n2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Got command action: getAttribute\r\n2016-04-07 14:19:08:724 - info: [debug] [BOOTSTRAP] [debug] Returning result: {\"status\":7,\"value\":\"This element does not have the 'class' attribute\"}\r\n"},"comment":{"url":"https://api.github.com/repos/appium/java-client/issues/comments/206954486","html_url":"https://github.com/appium/java-client/issues/355#issuecomment-206954486","issue_url":"https://api.github.com/repos/appium/java-client/issues/355","id":206954486,"user":{"login":"TikhomirovSergey","id":4927589,"avatar_url":"https://avatars.githubusercontent.com/u/4927589?v=3","gravatar_id":"","url":"https://api.github.com/users/TikhomirovSergey","html_url":"https://github.com/TikhomirovSergey","followers_url":"https://api.github.com/users/TikhomirovSergey/followers","following_url":"https://api.github.com/users/TikhomirovSergey/following{/other_user}","gists_url":"https://api.github.com/users/TikhomirovSergey/gists{/gist_id}","starred_url":"https://api.github.com/users/TikhomirovSergey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TikhomirovSergey/subscriptions","organizations_url":"https://api.github.com/users/TikhomirovSergey/orgs","repos_url":"https://api.github.com/users/TikhomirovSergey/repos","events_url":"https://api.github.com/users/TikhomirovSergey/events{/privacy}","received_events_url":"https://api.github.com/users/TikhomirovSergey/received_events","type":"User","site_admin":false},"created_at":"2016-04-07T15:31:55Z","updated_at":"2016-04-07T15:31:55Z","body":"@namannigam \r\nI've fouund the solution.\r\nYou should use 'className' instead of 'class'.\r\nThere lists of supported attrubutes: \r\n- boolean https://github.com/appium/appium-android-bootstrap/blob/master/bootstrap/src/io/appium/android/bootstrap/AndroidElement.java#L94\r\n\r\n- string https://github.com/appium/appium-android-bootstrap/blob/master/bootstrap/src/io/appium/android/bootstrap/AndroidElement.java#L182\r\n\r\nI'm waiting for your response and then I'm closing this issue. You can close it on your own."}}