Appium Android Windows: driver.findElement(By.name(" ")) is not working consecutively -
webelement username=driver.findelement(by.name("username")); username.sendkeys("test"); webelement password=driver.findelement(by.name("password")); password.sendkeys("test"); webelement loginbtn=driver.findelement(by.name("login")); loginbtn.click(); webelement backbtn=driver.findelement(by.tagname("button")); backbtn.click();
when using above testcase, username running when going password showing following error.
debug: appium request initiated @ /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-67452 0992c0a/element/1/value debug: request received params: {"id":"1","value":["test"]} info: pushing command appium work queue: ["element:settext",{"elementid":"1", "text":"test"}] info: [bootstrap] [info] got data client: {"cmd":"action","action":"element :settext","params":{"elementid":"1","text":"test"}} info: [bootstrap] [info] got command of type action info: [bootstrap] [debug] got command action: settext info: [bootstrap] [info] returning result: {"value":true,"status":0} info: responding client success: {"status":0,"value":true,"sessionid":"7 1ed55ce-c3ae-46d8-9ce7-674520992c0a"} post /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-674520992c0a/element/1/value 200 26 53ms - 89b debug: appium request initiated @ /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-67452 0992c0a/element debug: request received params: {"using":"name","value":"password"} info: pushing command appium work queue: ["find",{"strategy":"name","selector ":"password","context":"","multiple":false}] info: [bootstrap] [info] got data client: {"cmd":"action","action":"find"," params":{"strategy":"name","selector":"password","context":"","multiple":false}} info: [bootstrap] [info] got command of type action info: [bootstrap] [debug] got command action: find info: [bootstrap] [debug] finding password using name contextid: info: [bootstrap] [info] returning result: {"value":"no element found","status": 7} info: responding client error: {"status":7,"value":{"message":"an elemen t not located on page using given search parameters.","origvalu e":"no element found"},"sessionid":"71ed55ce-c3ae-46d8-9ce7-674520992c0a"} post /wd/hub/session/71ed55ce-c3ae-46d8-9ce7-674520992c0a/element 500 783ms - 22 3b
why findelement(by.name("")) not working second time?
check using appium inspector -> field 'password' might not have name value set "password" access it.
try accessing element using xpath instead :
webelement password = driver.findelement(by.xpath("//window[1]/scrollview[1]/secure[1]")); password.click(); password.sendkeys("psswrd");
follow following steps xpath or other attributes using appium inspector :
[1] launch appium server. [2] check check box 'app path'. [3] click on 'choose' button , select .app file location local, e.g. xyz.app [4] click on 'launch' button . once appium server launched, blue color icon besides 'launch' button enabled. [5] click on blue color icon, open appium inspector , simulator application :
you see element hierarchy of app displaying attributes name , xpath , value etc.
Comments
Post a Comment