0

Im using Appuim+ Selenium Webdriver. My App is build in Sencha FrameWork so that some of the elements can not be found using Appium Inspector. So I tried with HTML Xpath, but it gives "element not found exception".

Im pasting the code below:

wd.findElement(By.xpath("//*[@id='DashBoardView_cityInsightsItemId']/div/div/div[2]/div[1]/div")).click();

Err in Console is:

*exceptionorg.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: 1.52 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.51.0', revision: '1af067d', time: '2016-02-05 19:15:17' os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_73' Driver info: org.openqa.selenium.remote.RemoteWebDriver Capabilities [] Session ID: 4c466315-67c5-409e-9ffc-1f0d26c134c4 Element info: {Using=xpath, value=//[@id='DashBoardView_cityInsightsItemId']/div/div/div[2]/div[1]/div}*

HTML Code:

<div class="x-container dashboard_item_cls x-layout-box-item x-stretched" id="DashBoardView_cityInsightsItemId" style=""><div class="x-inner x-vertical x-align-center x-pack-center x-layout-box" id="ext-element-125"><div class="x-img x-img-image x-paint-monitored x-size-monitored dashboard_icon_cls cityInsights_icon_cls x-img-background x-layout-box-item x-stretched" id="ext-image-3"><div class="x-paint-monitor cssanimation"></div><div class="x-size-monitors overflowchanged"><div class="expand"><div style="width: 68.1875px; height: 68.1875px;"></div></div><div class="shrink"><div style="width:
67.1875px; height: 67.1875px;"></div></div></div></div></div></div>

I want to find this element:
<div style="width: 68.1875px; height: 68.1875px;"></div>

Why do I get this error and how do I solve it?

Martin Zabel
  • 3,589
  • 3
  • 19
  • 34
Joja
  • 1
  • 2
  • Did you notice the xpath you gave has "//*[@id=" at the beginning but the error message states "//[@id=..."? also can't you find a more specific xpath such as "//div[@id='DashBoardView_cityInsightsItemId']//div[@class="shrink"]/div" – Dror Feb 26 '16 at 04:39
  • Actually *** Element info: {Using=xpath, value=//*[@id='DashBoardView_cityInsightsItemId']/div/div/div[2]/div[1]/div} is the message i don't know why no * is coming – Joja Feb 26 '16 at 09:08
  • in Sencha framework class names ,ids are dynamically created. thats why I'm using only 'div' – Joja Feb 26 '16 at 09:11

0 Answers0