JumpIntoTheWater
JumpIntoTheWater

Reputation: 1336

How to press an Element by Xpath

I would like to click an Element (in Appium, using Selenium) by following hierarchy:

(1)LinerLayout --> android.widget.LinearLayout
   (0)RelativeLayout  --> android.widget.RelativeLayout
      (0)ImageView  -->  android.widget.ImageView

I have tried to use the following Xpath but without any success.

[FindsBy(How = How.XPath, Using  = "//'android.widget.LinearLayout[1]/android.widget.RelativeLayout[0]/android.widget.ImageView[0]'")]
 public IList<IWebElement> SearchStreetButton { get; set; }

Upvotes: 1

Views: 212

Answers (1)

Naman
Naman

Reputation: 31878

As mentioned in the comments as well to resolve such a problem, the X-Path shall not include the single inverted commas unless used with contains or any other string operation -

Changing the x-path as follows shall work -

"//android.widget.LinearLayout[1]/android.widget.RelativeLayout[0]/android.wid‌​get.ImageView[0]"

Upvotes: 1

Related Questions