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
-2
votes
0answers
22 views

How to parametrize the pdf [closed]

Download the pdf and read data and pass the input to next field.How to parametrize the pdf so that each time i download i should read only specific value. For eg:there are four member doing ...
2
votes
0answers
26 views

How to handle n number of dropdowns fields with same xpaths

I have two drop down fields which are parallel and there is button as well from where more fields can be addded at every row. There is no any limit on the fields to be added and have to fetch values ...
0
votes
1answer
89 views

Using FindBy in abstract class

I have couple of pages that have similar structure, similar elements. But selectors are different from the first tag. Example: Selector for the element on one page: @FindBy(xpath = "//picture-item//...
0
votes
3answers
485 views

Selenium Java WebDriver Can not Find Element with xpath

I've a question, how can I capture the xpath in the case below? I tried this: driver.findElement(By.xpath("//*[@id='L2_auto_8']/div/a[1]")); and I tried: driver.findElement(By.xpath(//a[@href='/...
0
votes
3answers
793 views

Selenium IDE type not saving text

I am trying to create an automation tool to test a salesforce platform. When I try to create a new form, the text is displayed but it's really just an injection from Javascript. Is there any way to ...
2
votes
1answer
25 views

Selenium python checkbox by span class

I have an issue with checkbox check in selenium python, I want to make not exact xpath, but something like I did earlier in the code : browser.find_element_by_xpath(".//span[contains(text(), 'Dalej')]"...
0
votes
2answers
175 views

How to click on an iOS MobileElement (button) which is dynamically changing using XPath

Below is the XPath- //XCUIElementTypeButton[@name="8/13"] The numeric value in the above XPath changes and is not static. There are more then 10 buttons on the screen, I want to click on the first ...
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....
0
votes
5answers
1k views

How to locate “Login” button of Flipkart bootstrap login page? I tried in many ways, but still unable to locate element

Below are three options I tried, but I'm not able to locate Login button. When I tried using seleniumIDE, I got this xpath=(//button[@type='submit'])[2] But its not working in Webdriver. Can someone ...
4
votes
2answers
656 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 ...
8
votes
7answers
22k 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
0answers
110 views

How to get text from span that is not in Latin Alphabet? [closed]

I'm having difficulty getting text between span tags. The problem is that the said text is not written in Latin Alphabet. I have no problems using UTF text as part of xpath locator. My xpath looks ...
15
votes
6answers
24k views

Which locator do you use with Selenium: CSS or XPath?

I have heard that, when using Selenium, the CSS Locator has better performance than the XPath Locator. Which Locator do you use in your tests? Have you seen a great performance improvement when ...
0
votes
1answer
64 views

Add XPath parameter dynamically in Selenium

Is it possible in Selenium to add an XPath parameter dynamically? I have following code: @FindBy(how = How.XPATH, using = "//div[@class='boxes']") public List<WebElement> boxes; String ...
1
vote
1answer
2k views

Unable to find element for a button in angular application through selenium webdriver [closed]

<span ng-click="addReqPage()" class=" wrapper-xs text-center cursor-pointer" tooltip-placement="bottom" data-toggle="tooltip" tooltip="Add Specification"> <!-- ngIf: ...
0
votes
1answer
839 views

Selenium script on Pega Platform application behaves weird

I have identified web elements uniquely using customized xpath //table[@pl_prop_class='SOM-FW-PayMaineFW-Data-ProductGroup']/tbody/tr/th[1]/div/div/div[1] But, when I run the test script and ...
0
votes
2answers
222 views

Selenium can't locate element by xpath

I am using Selenium and attempting to locate an element (table cell in a web app) by xpath. However, I am getting a NoSuchElementException when running my test cases. I am positive that the 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=...
0
votes
2answers
81 views

Selenium auto-selected the second element returned using the findElement method

As per the below code, I navigate to a specified URL and select the values in the from and to field. The xpaths mentioned in the 3rd and 4th line, each returns 2 instances. In the third line, ...
1
vote
1answer
57 views

Selenium C# Using relative XPath inside the wait.Until()

How do you use a relative xpath inside of a wait.until? For example, the below will work: elementA.FindElement(By.Xpath(.//div)); However, putting a 'FindElement' inside of the wait.Until() ...
0
votes
1answer
63 views

Python Dryscrape - how to select child element

I'm working on a project with www.NJMLS.com. I'm try to extract email of agent name "Edward An": import dryscrape as d d.start_xvfb() br = d.Session() br.visit('http://www.njmls.com/members/index....
0
votes
1answer
70 views

Why doesn't my XPath find my element on the page?

I am trying to retrieve the content of the header and each chapter which is a repetitive structure as you can see below. For this am using Selenium and C#. My attempt, using xpath, is this: string ...
3
votes
1answer
2k views

how to find element by xpath for android appium

Since these nodes don't have ids and text, I have used xpath to find the element but find element fails I have tried different xpaths as below but none work. xpath=//android.view.View[10] xpath=//...
1
vote
3answers
76 views

How do find XPath when only value is given in the source code?

What will be the XPath of a 'Search' button from the expression mentioned above?
3
votes
4answers
46k 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
4answers
463 views

Not able to click on menu using Selenium WebDriver Java

I am not able click on the specific element, which is in the image format. I have tried using available locators i.e id and image using XPath and remaining locators are same for all remaining menus. ...
0
votes
1answer
1k views

How to get src link using Selenium?

The task is simple: to extract the link of an audio of pronunciation for a word from a Yahoo Dictionary Webpage: e.g. Yahoo's Dictionary@ "real" Using "Chropath", I can locate the Xpath of the ...
-1
votes
1answer
34 views

Automation Selenium - Dynamic XPath [duplicate]

In the below XPath, the index [1] is changing every time. Can we handle this? //button[contains(text(),'Action')][1] HTML: <button aria-expanded="false" aria-haspopup="true" class="dropdown-...
0
votes
2answers
530 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 ...
2
votes
2answers
217 views

How to locate XPath for given tag? [closed]

I am trying to automate one of site and the below are the HTML code for same: <a href="http://register.rediff.com/register/register.php?FormName=user_details">Create a Rediffmail account</a&...
1
vote
5answers
4k views

Unable to click button using Selenium Webdriver Java

I am trying to click a button through webdriver. After inspecting the button element it highlights to the following: XPath: /html/body/div/div/main/div/div[2]/div/div[2]/table/tbody/tr/td[4]/form/...
0
votes
2answers
71 views

How to get XPath for the text after the <b> tags

I Need to get XPath for the following, to get the text after the <b> tags <li class="SpacedOut"> <b>Name 6:</b> "ABC" <b>Name 1:</b> "BCD" <b>Name ...
0
votes
1answer
37 views

not any locator works My Email address field are not fields automatically in testing selenium on login page

import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox....
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
3answers
71 views

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

I am attempting to locate the empty textbox by the input id 'Department_input' <input id="Department_input" type="text" aria-required="true" size="40" class="field_input ui-widget-content" ...
0
votes
2answers
66 views

Unable to find xpath using position(), last(),[1] indexing([1]--eg.) following:siblings, child, parent nothing is working

I am trying to find out the XPATH. I am getting 30 matches for an element. I tried using last(), position(), indexing[], child, parent, following:siblings, preceding:siblings, absolute XPATH is also ...
-1
votes
4answers
7k views

Button won't click even though I can see it's taking me to the button when doing automation

My code which takes me to the button and highlights it (I'm running java scripts within Eclipse) driver.findElement(By.xpath("//button[contains(text(),'Save')]")).click(); My HTML code <button ...
0
votes
2answers
51 views

How to write an xpath for a specific text from a whole attribute?

So the problem statement is: I need to store a specific number(marked in RED) from the attribute & for that I want to point to that number in an xPath. Is that possible?
0
votes
2answers
2k views

How do I use XPath to find the values of cells in a table

The structure of the Html I need to work with is shown in the screenshots below. I need to get the values of the first and third column of each data row in the table. There is nothing unique about ...
8
votes
4answers
68k views

Webdriver: How to find the element using text() in xpath?

I'm new to selenium and HTML. I want to perform click operation for the elements "Users" and "Admins" as one after another. Below mentioned is the HTML code, unfortunately I can't modify it. <ul ...
1
vote
1answer
73 views

Scrape items from an HTML list

When Catalog receives a fragment for a book category, it seems to my eyes, to be just list items. For space, I didn't include that output. How can I ensure that only categories which belong to the ...
0
votes
1answer
29 views

Verify and Assert functions does not work as expected in Selenium IDE?

I'm using Selenium IDE to record steps. Web system has developed using Angular.js I tried to use verify text and assert text functions through IDE. For target elements, xpath is given. Same xpath is ...
4
votes
3answers
321 views

Can we programmatically update locators on UI Change in UI test automation?

I have been working in test automation for the last 10 years. The problem that keeps coming up and surprisingly is still unresolved is: Can we programmatically update locators on UI Change in UI test ...
0
votes
1answer
108 views

How to deal with ui-sref in Selenium

The Context: I'm using selenium in java to click on a link to navigate to the other page of the application. The Problem: The application is made in angular-js wherein I tried to click on the Link,...
0
votes
2answers
165 views

Unable to locate Text element using XPath in Selenium [closed]

This is my HTML page and I have some problem with my automation code and it is not able to locate the element and this is the XPath I used: @FindBy(xpath="//div[contains(text(),'Done')]") HTML Code: ...
1
vote
1answer
33 views

Testing a pop-up in Selenium

How to select text from pop up which is opened in the same page in Selenium. With WebDriver I can only check the element from the page, not from pop up.
0
votes
2answers
42 views

find xpath for 'PAINEL DE CONTROLE EDITORA'

Facing issues while locating element outside the span please refer the images and post the xpath for it. Update: I have tried the suggestion in Upkar Singh's answer and the xpath below with no ...
0
votes
1answer
46 views

Locator Issue regarding multiple attribute

I've located an element correctly by using the following XPath... //a[@class=\"desktop-categoryLink\"][@data-reactid="30"] But when I paste this in my eclipse it looks like below... driver....
0
votes
0answers
263 views

could not be scrolled into view - loop over options of menu

I have a page in which you click on date first, then region and finally province and get a link to download a file. I am trying to create a loop that goes throuth all the dates, regions and provinces, ...
0
votes
3answers
338 views

Unable to find element with css selector == input[name='username']

WebElement username = driver.findElement(By.cssSelector("input[name='username']")); The statement mentioned above was working before but right now concerned element can't be captured and error ...