Hi all,
i get stuck with locate an Elemenet by content-desc. Anyone has idea for below case :
i am trying to locate an elment by xpath:
So my xpath :
if(!driver.findElements(By.xpath(“//android.view.View[@content-desc,‘Dinh Nguyen: good morning’]”)).isEmpty()){
return true;
}
else{
return false;
}
the error : org.openqa.selenium.InvalidSelectorException: Argument was an invalid selector (e.g. XPath/CSS).
i check and see the xpath in running time is :
Element info: {Using=xpath, value=//android.view.View[@content-desc,‘Dinh Nguyen: good morning’]}
Below is log in appium :
debug] Pushing command to appium work queue: [“find”,{“strategy”:“xpath”,“selector”:“//android.view.View[@content-desc,‘Dinh Nguyen: good morning’]”,“context”:“”,“multiple”:true}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {“cmd”:“action”,“action”:“find”,“params”:{“strategy”:“xpath”,“selector”:“//android.view.View[@content-desc,‘Dinh Nguyen: good morning’]”,“context”:“”,“multiple”:true}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: find
info: [debug] [BOOTSTRAP] [debug] Finding //android.view.View[@content-desc,‘Dinh Nguyen: good morning’] using XPATH with the contextId: multiple: true
info: [debug] [BOOTSTRAP] [debug] Returning result: {“status”:32,“value”:“javax.xml.transform.TransformerException: Expected ], but found: ,”}
info: [debug] Responding to client with error: {“status”:32,“value”:{“message”:“Argument was an invalid selector (e.g. XPath/CSS).”,“origValue”:“javax.xml.transform.TransformerException: Expected ], but found: ,”},“sessionId”:“b49d819f-d91a-438c-a353-780ecd76be99”}
info: ← POST /wd/hub/session/b49d819f-d91a-438c-a353-780ecd76be99/elements 500 31.507 ms - 218