We’re rewarding the question askers & reputations are being recalculated! Read more.

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
4answers
5k views

How to fetch the text from span tag?

I need to fetch text 'Finance' from the span tag below to compare that with another value which is saved in a file.But I am not able to fetch that. <span class="panel-text col-md-8">Finance</...
1
vote
1answer
1k views

Not able to check the checkboxes on a javascript page

Here is the code I used to select the checkboxes selectAllEmployeeInputRequired() { this.scrollToAndClick(this.employeeInputButton); return browser.wait(this.isVisible(this.employeeInputModalForm)) ...
-4
votes
1answer
2k views

How to write XPath under tag: strong

I want to red text under strong tag I have written XPath like: //section[2]/section/div[1]/div/div[1]/div[2]/text()[1] Here is the HTML code: <div class="listing-info"> <h4>Listing ...
-1
votes
2answers
102 views

Not able to find the Xpath, really complicated for me. Need help

i am not able to find the xpath for a text box and get the value from it the code is here. please help me find the xpath to locate the box and get the value from it.
0
votes
2answers
154 views

Can any one explain this xpath

Anyone can you please explain this xpath please. why we use '"+filterBy+"' rather than "+filterBy +" in this code segment. (I just simplify the code.this not an original one.) String filterBy = "Hio";...
0
votes
2answers
4k views

Dynamic ID locating element [duplicate]

New to Automation , I am using selenium with JAVA. I have come across a stumbling block our developers do not assign ID to our elements and JFS assigns it own ID , however the ID's are dynamic and ...
1
vote
1answer
1k views

Selenium Python Bindings - Accessing Submenu Items

I am using Selenium to write unit tests for a website to test scientific software. The backend uses Flask to generate a sidebar where each project is clickable with a dropdown menu. You can only open ...
1
vote
1answer
18k 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. ...
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="...
2
votes
7answers
7k views

How to find the xpath locator for logout button?

We are currently working on a selenium project. Can you guys help me to find the xpath locator for the logout button in the application? Below is a screenshot of the code for the element for which I'...
0
votes
2answers
972 views

Help in locating an image button inside div element

So I am trying to automate a test and my issue is that I cannot point to the button element which is actually an image inside of a div. I tried going down the hierarchy but no luck. this is the code I ...
0
votes
2answers
2k views

Not able to locate the web element with partial xpath and text [duplicate]

I have web element set like below .. <div class="dxnb-headerCollapsed" id="ctl00_LeftPanel_LeftNavigationMenu_nbMenu_GHC1"> <i class="fa fa-handshake-o fa-2x fa-fw" style="">&...
-3
votes
1answer
300 views

Unable to locate element using this XPath [closed]

This is my xpath - //*[@id="284623"]/div[4]/div[4]/img Unable to locate element using above XPath. Please help..!
-1
votes
1answer
338 views

How to write XPath if my ID is changing continuously? [duplicate]

//*[@id='post-9505']/h3/a/time //*[@id='post-9466']/h3/a/time //*[@id='post-9517']/h3/a/time In this id number is changing continuously, so how can i write dynamic XPath? please help me to write ...
0
votes
1answer
2k views

Xpath is not working using contains and starts with having random values

XPath is not working using contains() and starts-with() functions for below ID id="u_0_3" I have tried with: //*[starts-with(@id,'u_')] - startswith //*[contains(@id,'u_')] -contains Can ...
1
vote
1answer
411 views

Continue WebDriver test execution, when element is not visible/clickable

I have a Selenium WebDriver based testsuite. XPATH on site are changing sometimes, so I would like to use this to identify which XPATH has to be refreshed. So in case element isn't visible or not ...
2
votes
2answers
4k views

Selenium webdriver - Cannot find button inside modal

I cannot click on this button contained in a modal this is the html <div class="col-md-6 col-sm-6 col-xs-12"> <button class="btn modal-button full-btn" id="saveexit" type="button"> ...
-1
votes
1answer
585 views

How to handle if XPath are different for multiple sub-menu options [duplicate]

I have situation when i have click main menu options it will be display 10 different sub-menu options. In all sub-menu section is available 2nd sub-menu options which is available more than 20 menu ...
7
votes
4answers
3k views

same xpath on the page with dynamic ID selenium java

I have a problem with the two same XPath with dynamic ID on the same page. I have tested for selenium in java, when I need to confirm button on delete upload file. Instead of this, test first submits ...
1
vote
1answer
85 views

XPath error for Google Sheets

I want to get live data from a website. I select inspect and copy the XPath from where I want the data to import, but I get an #ERROR!. =IMPORTXML("https://www.jamstockex.com/market-data/listed-...
1
vote
3answers
373 views

Not being able to locate an element using contains() in xpath

I want to locate the element using Reject from the below: <span ng-click="moderatePost(post,'R')" role="button" tabindex="0"> <i class="icon-delete-cross f-s-20 show-hide"/i> ...
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 ...
0
votes
1answer
5k 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
354 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
109 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 ...
4
votes
2answers
358 views

Localization of Ranorex XPaths

Our application is available in German and English, other languages may follow. Given I have an XPath like /form/button[@text="Login"], is there a convenient way to have it translated? At the moment ...
1
vote
1answer
115 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
725 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
542 views

Xpath for sign out button

I am trying to find out XPath for this "Sign Out" button, can anyone help me?
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
182 views

Selenium- Unable to save dynamic paths in the list..list shows 0 as size

import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium....
1
vote
4answers
70k views

How to use Xpath 'contains()' function to locate a Web element in Selenium Webdriver?

I am a beginner in learning Selenium WebDriver and XPath. I am trying to get the "<td>" Element of the Nested Table which Contains string '7-8-9.' Following is the HTML page code: <!DOCTYPE ...
2
votes
2answers
5k views

How to add HTML/text content of a <div> into an array/list?

I am new to selenium and working with xpath. I am using selenium and java to write automated tests for chat messaging web application. I am looking for a way to take a webElement which contains ...
4
votes
5answers
18k 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 ...
1
vote
1answer
523 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). ...
1
vote
0answers
384 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[@...
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
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('...
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. ...
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(...
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 ...
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
2answers
876 views

Identifying objects in Selenium

I have been asked on interviews about identifying objects, so I got a little confused. All of the below questions are related to identifying elements, so I combined them together: Is there any other ...
4
votes
1answer
441 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
5answers
3k views

How to locate the XPath of an element in eclipse accurately?

I am working on a project in which automation is done using Appium Tool. I felt it difficult to track the XPath of an Image or Textbox in Eclipse while scripting. Sometimes the XPath will be given as ...
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 ...
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 "//*[@...
2
votes
2answers
15k views

How can I dynamically create an xpath string in Python for a webdriver xpath selector?

I am writing a Selenium Webdriver test using python2.7 to use XPath to select a link node set. For each link, I need to change the href attribute using driver.execute_script to execute javascript. ...