{"action":"opened","issue":{"url":"https://api.github.com/repos/appium/java-client/issues/486","repository_url":"https://api.github.com/repos/appium/java-client","labels_url":"https://api.github.com/repos/appium/java-client/issues/486/labels{/name}","comments_url":"https://api.github.com/repos/appium/java-client/issues/486/comments","events_url":"https://api.github.com/repos/appium/java-client/issues/486/events","html_url":"https://github.com/appium/java-client/issues/486","id":182247874,"number":486,"title":"java.lang.NullPointerException on waiting an element to be displayed","user":{"login":"jeangb","id":22364949,"avatar_url":"https://avatars.githubusercontent.com/u/22364949?v=3","gravatar_id":"","url":"https://api.github.com/users/jeangb","html_url":"https://github.com/jeangb","followers_url":"https://api.github.com/users/jeangb/followers","following_url":"https://api.github.com/users/jeangb/following{/other_user}","gists_url":"https://api.github.com/users/jeangb/gists{/gist_id}","starred_url":"https://api.github.com/users/jeangb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeangb/subscriptions","organizations_url":"https://api.github.com/users/jeangb/orgs","repos_url":"https://api.github.com/users/jeangb/repos","events_url":"https://api.github.com/users/jeangb/events{/privacy}","received_events_url":"https://api.github.com/users/jeangb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-10-11T12:13:19Z","updated_at":"2016-10-11T12:13:19Z","closed_at":null,"body":"## The problem\r\n\r\nHello,\r\nWhen I try to wait until an element is displayed on my native application, I got a java.lang.NullPointerException.\r\nIt's strange because it happens after I sucessfully handled elements before.\r\n\r\n## Environment\r\n\r\n* Appium v1.4.16\r\n* Windows 7 64bits\r\n* I use appium.exe\r\n* Android 4.4.2\r\n* Samsung Galaxy S4\r\n* API java client is 4.1.2\r\n\r\n## Details\r\n\r\nI'm testing the log-in function of an android open-source application.\r\nThe application is successfully launched, and appium is able to hit and edit the login and password texfield, then the login button.\r\nThen I want to wait that my main activity is displayed. And that's where I have my NullPointerException error.\r\nAppium doesn't wait a second and failed at this point :\r\n`MobileElement mainMenuBis = (MobileElement) (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.xpath(\"//android.widget.ImageButton\")));`\r\nMy failure exeception : https://gist.github.com/jeangb/1c523708f0c91dac026a4616c07772b0\r\nThe appium server logs : \r\nhttps://gist.github.com/jeangb/7d628731c752facc1c829eca55d9ff55\r\n\r\nNote that if I use a thread.sleep(5000) or I wait that the element is displayed with the eclipse debugger, it will not fail. I don't want to use a thread.sleep.\r\n\r\nMy driver:\r\n`public static AppiumDriver driver;`\r\n\r\nIt's instanciate in my setUp function like this:\r\n```\r\n\t\tDesiredCapabilities capabilities = new DesiredCapabilities();\r\n\t\tcapabilities.setCapability(\"deviceName\",\"<redacted>\");\r\n\t\tcapabilities.setCapability(\"platformName\",\"Android\");\r\n\t\tcapabilities.setCapability(\"platformVersion\", \"4.4.2\");\r\n\r\n\t\tcapabilities.setCapability(\"appPackage\", \"im.vector.alpha\");\r\n\t\tcapabilities.setCapability(\"appActivity\", \"im.vector.activity.LoginActivity\");\r\n\r\n\t\tsetDriver(new AndroidDriver<WebElement>(new URL(Constant.Server_Adress),capabilities));\r\n```\r\nDoes anyone knows why it doesn't wait ?"}}
{"actor":{"display_login":"jeangb"}}