Questions tagged [xpath]

XPath (XML Path Language) is language for addressing parts of an XML document, designed to be used by both XSLT and XPointer. It also provides basic facilities for manipulation of strings, numbers and booleans. XPath uses a compact, non-XML syntax. XPath operates on the abstract, logical structure of an XML document, rather than its surface syntax.

Filter by
Sorted by
Tagged with
1
vote
0answers
123 views

How to inspect an element with multi attributes by OR operator in Page Objects model in watir?

I have a problem when trying to find an element with different attribute as sample bellow <i>bold</i> Sometime <i class='icon'/i> I want to try inspecting this element with OR ...
-1
votes
2answers
4k views

How to write XPath under tag: strong<> <br> after every <strong>

I am trying to find xpath of text 262567 of given below HTML code : <div class="lessthanhalf" > <h4> Listing</h4> <strong style="background: rgb(204, 136, 136); border: 2px ...
0
votes
1answer
6k views

Matching multiple classes with an XPath expression

I am trying to automate the Scenario of NSE India https://www.nseindia.com/. I am trying to capture the Nifty50 increment or decrement value using Xpath as //nobr/span[@class='red'][1] when sensex is ...
0
votes
1answer
44 views

Can someone help me to correct this date picker excerpt [closed]

I need help to correct this excerpt. The excerpt is not working right now. I have attached the screen shot here. //h3[text()='Alert Expiration']/..//table[contains(@class,'vdl-calendar__grid') and ...
-1
votes
1answer
381 views

Capturing the xpath/locator of the Edit Status in Facebook

I am trying to Post a status in FB using selenium. But i am not able to correctly locate the Edit status text and getting NoSuchElementException. I have tried different xpaths, which are correct too ...
0
votes
1answer
111 views

Are SelectById, SelectByClass and SelectByName just special cases of general SelectByTag?

2 questions in 1: 1) In all the Selenium tutorials they divide the ways of finding elements in the way like: 1. By ID 2. By CLASS 3. By NAME 4. By TAGNAME 5. By CSS Selector 6. By Link 7. By XPath I ...
1
vote
1answer
19k views

How to use a regular expression to identify xpath of element with autogenerating id

I need to access this element: <input id ="combo-1105-inputWrap"> The 4 digits in the xpath are autogenerated per browser session. I need to find that particular xpath and key in the data. ...
1
vote
1answer
116 views

I cannot find the locator for this dropdown list of below html code and PICture [closed]

Below is the html code: <li> <a id="inputBox" class="menulink menuhover">Scotia Mortgage</a> <ul id="listOptions" style="overflow: visible; display: block; height: 148px; ...
1
vote
1answer
739 views

Trying to automate a date-picker- having issues locating dates in the past

I am automating an app using a blend of Coded UI and Selenium in Visual Studio. I have an app that uses a date picker (seems like it's using Bootstrap but not entirely sure). Using XPath, I can locate ...
2
votes
4answers
96 views

How different the execution would be if we use ID or xpath with ID?

Since we say that IDs are faster and are preferred over XPaths, how different would the execution of the following be? driver.findElement(By.xpath("//button[@id='Save']")).click(); driver.findElement(...
2
votes
4answers
11k views

Selenium webdriver select element “next to” already selected element

Hi I'm using selenium on Java and here's the situation: <article> <div class="inner-article"> <a style="height:150px;" href="link"> <img width="150" height="150" src="...
1
vote
0answers
391 views

Unable to locate the elements of SmartGWT application using Selenium in IE browser

I'm testing a GWT + SMARTGWT application and I'm trying to locate the elements of this web application using Selenium Webdriver. The method which I have used to locate the elements is by the relative ...
-1
votes
1answer
84 views

How to massage or format html in order to parse with xmlstarlet?

Just looking to parse html found "in the wild": Very simple script: curl -s http://www.foo.com > 1.html xmlstarlet fo -H -R 2> /dev/null 1.html > 2.html xmlstarlet sel -t -v "//header[@...
1
vote
2answers
148 views

What are the types of Xpath expressions for web application automation

What types of Xpath expressions can I use when automating web applications? I need to know different ways of finding elements so that if I can't use an ID I can always locate the element I need to ...
0
votes
1answer
3k views

How to find element with find_element_by_xpath multiple names selenium

I'm looking for a site where the name of the ID depends on some variables that I can't control. So the ID can either be "sub_allGoods_4", "sub_allGoods_12" or whatever number: find_element_by_xpath('...
2
votes
3answers
17k views

How to access a Hyper link using XPath

What is correct format for using XPath? Does XPath vary with the browser? drchrome.findElement(By.xpath("//a[contains(.,'Google')]")).click();
0
votes
3answers
3k views

Can't send values using sendKeys function in Selenium

This is the html line for field I am trying to locate: <input class="textbox" name="txtUserLoginID" maxlength="25" value="" type="text"/> My XPath is: WebElement username = driver.findElement(...
4
votes
4answers
12k views

How should I find the XPath using selenium webdriver and protractor

I'm a beginner in automation testing. I'm trying to select a value from data list and I got an XPath like mentioned below: XPath : html/body/div[2]/div[1]/div/div[1] This is the HTML for the same :...
1
vote
3answers
14k views

Locator has 3 matching nodes. How to get Selenium identify the required element?

I'm new to Selenium WebDriver. I'm trying to automate a search function on a particular page. There are a search input box and a search button (actually, it is a search icon) next to it. I'm able to ...
1
vote
1answer
1k views

Find XPath for dynamic numeric value in a web page

Looking for an XPath for a webpage where after every booking a Rel# generate. Need to validate the Rel# is saved in a different tab or not. So the HTML page says: I tried with the given xpath "//*[@...
0
votes
2answers
10k views

Unable to find the element in selenium web driver

I am trying to run the below code but getting error. Can you please point out the issue import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa....
0
votes
1answer
6k views

How to get the XPath for all tables in a page?

How do I know or find the xpath for table? Or, even better, get the xpath for all tables in a specific page? I'm getting no_such_element when running: public void test() { String ...
-1
votes
1answer
48 views

Unable to customize xpath

I want to select all the products having rating 4.5, I could do that with the help received from StackExchange. Now I want to add the products with rating 4.5 to the cart. However, I am not able to ...
0
votes
2answers
147 views

I am automating coop website and I'm facing problem while customizing XPath for add to cart button

I have customized an XPath for adding a product which has discount 30% for 2. Now I am facing problem while adding this into the cart. package sample; import java.util.ArrayList; import java.util....
1
vote
1answer
542 views

Not Able to Login to Ebay using Selenium

I am trying to Login to Ebay site using Selenium. I have successfully identified the user name and password Text boxes using Xpath (and validated the xpaths using the Firefox Eval tool in Firebug). ...
-2
votes
4answers
1k views

Unable to customize XPath containing span

I want to select all the products having rating 4.5 and add to the cart. However, I am not able to customize the XPath. I tried the below XPath: //div[@class='product-item__rating']/span This ...
0
votes
2answers
898 views

How to locate below element TableHeader using xpath [duplicate]

I want to locate element 'TableHeader' in given DOM, I am using XPath but getting an exception unable to locate the element. Xpath : //div[@class='PageContent']/table[1]/tbody/tr/td[2] Please have a ...
1
vote
1answer
7k views

How to get nested web element in dynamic table using xpath

I have a table which is dynamic (so i can't use strict locator or paths) <tbody> <tr class="odd" role="row"> <td>Company</td> <td class="sorting_1"> <td>22222@...
2
votes
4answers
558 views

Xpath for sign out button

I am trying to find out XPath for this "Sign Out" button, can anyone help me?
4
votes
4answers
8k views

Find first IMG element using XPATH

I am trying to find first fridge IMG element in a e-Commerce page but I could not find it alone, It's identifying all Images under First DIV.. Please share you thoughts I tried below XPATH, is there ...
-1
votes
3answers
1k views

Appium - why does XPath not work (at all / as expected)

Consider my below test code for Appium (WinappDriver). As far as I know, these two locators should be equivalent. Yet the second one fails because the element cannot be found. Is there any reason ...
4
votes
3answers
14k views

Selenium: :How to click a button using the button label?

In the HTML code like this: <a class="test-class"> <div class="test-content"> <div class="test-time" data-start="12:13pm" data-full="12:13 PM - 12:50 PM"> &...
2
votes
4answers
698 views

Unable to locate element as ID changes after refreshing the in Ebay login page

Using JUnit I'm attempting to automate the eBay login. I cannot select the email/username field because field changes id on refresh. Any ideas? input size="40" maxlength="64" name="962970435" id="...
3
votes
3answers
4k views

How can I select <ul> element when class is not active

How can I select "Fiyata göre Artan"? <div class="search-top hidden-xs"> <div class="destination-info hidden-xs"> <div class="search-sort dropdown open"><div class="pseudo-border-...
1
vote
1answer
407 views

NoSuchElementException: Cannot locate an element using XPath

I am getting XPath error. Already tried with many XPath's. But not able to resolve. Can anyone give correct XPath? XML: <form id="report-filter-form" class="report-filter-form" accept-charset="...
4
votes
2answers
709 views

How to use Jmeter Xpath extractor for multiple run in dynamic API elements

XPath extractor response assertion passed first run but in second run it is getting failed because <name>pc</name> is not coming in API. How to skip this element if it is not coming in ...
3
votes
2answers
5k views

Cannot get attribute value when using xpath

I met a problem when I try to get an attribute of one tag. Here is the html code: <rect x="66.5" y="43.5" width="26" height="13" fill="#86E067" stroke="#ffffff" stroke-width="1" class="...
2
votes
4answers
14k views

How to identify the web-element for a Text Box using Selenium for the dynamically changing ID

I have a input text box having id property and the HTML for it as shown below username:<input type="text" id="1234"><br> Id property is dynamically changing. when the page loads next ...
0
votes
1answer
3k views

No such element exception while handling elements inside tables in Selenium Webdriver

I'm trying to access a select HTML element using Selenium WebDriver. But I'm getting a org.openqa.selenium.NoSuchElementException. This is happening only while handling elements inside a table. ...
4
votes
1answer
448 views

Watir can't locate an element with xpath [closed]

I got this html (It's simplified to see the deep) <html> <frameset> <frame> #document <html> <body> ...
1
vote
1answer
36 views

Unable to return both attributes using XPath in JMeter

I have the following xml: <td class="tableCell restrictionCell"> <span class="restrictionEditLink" rId="202">edit</span> &nbsp;<span class="restrictionDeleteLink" ...
2
votes
2answers
763 views

Watir can't click on an element but can on irb

I have this command: @browser.element(:xpath => "/html/body/app/pages/div/div/div/div[3]/mi-perfil/div/div[3]/datos-personales/div/div[1]/span[2]").click There is no problem with the direction of ...
3
votes
4answers
49k views

How to get value of text wrapped in paragraph element <p> with Selenium in Java

I have a button, clicking on it generates a number which is wrapped in paragraph text such as <p>random number <p> , I want to get that random number value and do operations based on ...
0
votes
2answers
556 views

XPath of an element keeps changing when testing in different OS or device

Me and my team sometimes experienced this issue when testing one Cucumber feature in: different version of Android and iOS different device with same OS version. This really slowing us down ...
1
vote
2answers
2k views

How to handle xPath returning Boolean instead of element?

I have xPath which returns boolean:true instead of finding an element on the page. Test page has a table with 2 columns and multiple rows. I'm testing if the rows have correct values. Below is the ...
0
votes
1answer
3k views

How to handle web element(enable button) having same Xpath?

I am working on a web page which having 3 web elements with 3 enable buttons and all buttons having same Xpath.so my need is to click on the button A and print the title of the webelement on every ...
0
votes
3answers
7k views

How to get XPath from different div?

Below mentioned two urls: http://www.espn.com/nhl/boxscore/_/gameId/400896617 http://www.espn.com/nhl/boxscore/_/gameId/400885545 How can I get XPath after player summary content. 1st url is XPath ...
4
votes
1answer
21k views

how to handle if xpath is same for multiple drop down

I have a situation where i had to handle drop down and click the drop down to select some values. There are two drop down in same page and both has same xpath. The Xpath is giving below. //div[@name=...
8
votes
7answers
25k views

How to write XPath if I have 'apostrophe' in my XPath element?

I came up in a situation where I have to identify an element using XPath and my element starts with apostrophe ('). I will give the example below. This is the usual way we write some XPath. By ...
2
votes
4answers
3k views

How to find an element that may be in multiple xpath locations?

In a Web page having the following xpaths. xpath1 = By.xpath(".//*[@id='gamepackage-game-information']/article/div/div[2]/span")).getText(); xpath2 = By.xpath(".//*[@id='gamepackage-game-information'...