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
1answer
709 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
375 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
82 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
147 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
2k 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
16k 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
11k 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
13k 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
9k 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
510 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
946 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
836 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
6k 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
514 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
7k 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
13k 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
665 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
385 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
674 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
4k 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
13k 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
438 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
35 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
739 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
47k 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
536 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
20k 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
23k 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'...
0
votes
1answer
329 views

JMeter - unable to return correct argument from list in XPath extractor

In order to generate HTTP requests to open a particular window, I need to obtain the component ID which is nested as an argument in onmousedown="Console.openView()" - in this example componentId= 1325....
3
votes
2answers
199 views

Identifying if an element is present or not using selenium

I have a SAVE button which is active only if I do some changes and then trying to save it. Otherwise its disabled. This is the html for that button: <button id="customize-site-save" class="...
2
votes
3answers
728 views

Clicking on a Xpath

I have a back button on my web page which I need to click on from different places. In one page the back buttons xpath looks like: //property-list/ion-header/ion-navbar/button In another other page ...
1
vote
2answers
577 views

How to select an item from a drop down list with same text appearing along with other text

I'm using selenium/java and have a drop down list for languages. This list contains multiple variations of "English" as you can see in the code below. I want to select just "English". I thought of ...
4
votes
5answers
17k views

How to locate an element which is visible only by mouse hover in selenium webdriver

I want to find an element which is visible by mouse hover and I need to click on it and it then opens a text field. When I give the XPath for the element in fire-path, it detects 6 instances of the ...
4
votes
2answers
1k views

Dynamic XPath in Selenium - which input field keeps changing

I tried to find the XPath of a text field username and password, but it keeps on changing dynamically. I won't be able to use starts-with or contains in a findelement using XPath. Here's the HTML DOM- ...
1
vote
3answers
2k views

what type of list does FindElements(ByTagName(“a”)) returns? [closed]

public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:/Automation Stuff/ChromeDriver/chromedriver.exe"); ...
4
votes
4answers
7k views

How to click a link when more than 1 exists?

I want to click the link in one container but the container contains two links having the same identifier. For example: <div id="container" style="height:88 px; width: 310px;"> <a class="...