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.
305
questions
0
votes
2answers
19 views
Extract InnerHTML from
Is there a way that I can extract the following data in Chrome Devtools Console.
Currently I do the following in the console of the chrome devtool:
$x("//a")
I get a list with all the a ...
0
votes
0answers
11 views
Selenium IDE - how do I 'click' custom Angular events?
I'm trying to test/debug an Angular app that generates a calendar (note: I cannot currently modify the application.)
I believe the Angular calendar used is:
Components / CalendarMonthViewComponent
I'...
0
votes
3answers
56 views
Issues creating custom xpaths
I've became lost in the world of xpaths, so got an advice to create custom xpath, instead of coping this one, for example
"/html/body/div[1]/div[4]/div[1]/div[7]/div/div[2]/div[3]/div/form/div[2]/...
0
votes
0answers
17 views
How to choose a result in a dynamic webtable that has the same name and later timing in Selenium Python?
I have been working on a Selenium project in Python where I want to choose the result which has a later timing than the earlier one but have trouble implementing it. What I meant is this,
Example
if ...
0
votes
1answer
44 views
How to find all child elements inside a WebElement or List of WebElements in Selenium?
I have a <section> tag in which there is <tfoot> tags and many <td> tags.
I want to store the 1st & 4th td elements of a in a Map, but i get index out of bounds exception.
Now, ...
1
vote
1answer
60 views
locating element with one class out of multiple classes inside a div using xpath in selenium
I have below two input fields and I have to find there location I can't use class selector cause iI have to identify element based on formcontrolname and ng-invalid class
<div>
<input ...
-1
votes
1answer
35 views
Understand How to Click on an a Table Element (URL) Based on a Value in that Same Row Using Selenium
I am automating steps in a browser using Selenium/Python; however, I am stuck with trying to understand how to get Selenium to recognize a text value in a table and click on the URL in the ...
1
vote
1answer
307 views
RobotFramework: Link/List with locator not found
I am studying Robot Framework with Selenium Library and I can't figure out how to remove "kw" element from the next dropdown:
I tried to use xpath for it:
*** Settings ***
Library ...
1
vote
1answer
154 views
Automating a comment delete on FB with Selenium
I am trying to automate deleting my old comments on posts I've made on FB.
Im using Selenium with python to achieve this.
I am currently having trouble dealing with pressing the hidden buttons (1 &...
0
votes
1answer
135 views
Selenium C# Locate Both Data QA Attribute And CSS Class
How do we locate both Data QA Id and CSS Class using Selenium C# ?
We're trying to locate both a DataQAid attribute and also see if its class ng-invalid, (Angular Material Textbox Error)
This is what ...
0
votes
1answer
508 views
Unable to fill the card details for Payments using Selenium at the merchant's checkout page
I have just started learning Selenium web automation tool and wanted to auto-fill the card details on the merchant's Payment Page but unable to do so using Selenium.
Below are the things which I tried....
-2
votes
3answers
47 views
XPATH clarification [closed]
Refer: Picture of elements of HTML screenshot
I am trying to get XPATH
//*[@id="pg:pbEdit:conlist"] or //select[@id="pg:pbEdit:conlist"]
Works but I want to be precise not ...
1
vote
1answer
40 views
Variable in Xpath is not working
#driver.find_element_by_xpath('//div[@id="groups"]/div/div/div/div/div[2]/div[1]/div/div/button').click()
i = 5
gPath1 = str("\'//div[@id=\"groups\"]/div/div/div/div/div[2]/...
1
vote
1answer
121 views
Using loop how to get dataframe from each next pages and store table values using Selenium Python
https://seffaflik.epias.com.tr/transparency/tuketim/gerceklesen-tuketim/gercek-zamanli-tuketim.xhtml
from the above website, I've achieved to enter date picker for two date range and then clicking &...
0
votes
1answer
32 views
How do I write a better xpath of this element? [duplicate]
I am working on a project and building automation test suite for a webpage. A certain part of the webpage looks like this.
The corresponding HTML is as follows:
<p class="customer-service&...
0
votes
1answer
50 views
I want to enter text in search text box and click search icon or enter [duplicate]
I am facing the issue . Kindly assist.
The HTML Code snippet is attached
I am getting the error as
Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: ...
0
votes
1answer
64 views
Finding a xpath for text which is followed by break tag
I have below HTML code, in that I have to come up with XPath for the 2nd line of text: "Policy Count - 0".
<h2 id ="lblpremiumVol">
"Premium Volume - $"
<br>
&...
0
votes
4answers
70 views
How to write the xpath for an element preceded by another element?
I want to get the value from an element based on the element preceding it.
For example, getting the value "YYYY-MM-DD" based on the element "date"
Here is the html snippet:
0
votes
1answer
520 views
Error: Exception in thread “main” java.lang.NumberFormatException: For input string: “”
Scenario: I am using Selenium Java. I need to add items to the cart and calculate the total price of the items in the cart.
Url: https://rahulshettyacademy.com/seleniumPractise/#/
Issue: My code is ...
2
votes
1answer
72 views
The instruction (Keys.ARROW_DOWN) is moving the cursor to the bottom of the dropdown list instead of the first option
Scenario: To search and select the first destination location that matches the input string using the below code.
Code snippet:
driver = new ChromeDriver();
driver.manage().timeouts()....
2
votes
1answer
61 views
The value from the table is different using Xpath and CSS selectors
Test url=https://www.cricbuzz.com/live-cricket-scorecard/22585/aus-vs-nz-1st-odi-new-zealand-tour-of-australia-2020
I am trying to get the title of a table using the below code:
Code snippet:
...
-1
votes
1answer
24 views
How to get “10:20 AM IST” from that code using xpath in selenium
<div class="game-date-time">
<span data-date="2017-03-11T04:50Z" data-behavior="date_time">
<span class="time game-time" data-dateformat="time1" data-showtimezone="true">10:20 AM ...
0
votes
1answer
931 views
Problem with finding element with Selenium and Xpath
I have a problem that is very strange for me because the code that I wrote, I am quite sure should work!
Config Details
Chrome version: 80.0.3987.132
ChromeDrivers version: same as ...
0
votes
1answer
179 views
No Such Element (Selenium) [duplicate]
I have checked far and wide for a fix for this. But to no avail. Nothing seems to work. I am trying to locate a Username and Password box to enter in the information. But it comes up with the error
...
0
votes
5answers
342 views
Element not found in a runtime
I am encountering a very unusual thing, the one I haven't seen before. There is one element I needed to find for testing purposes, it is visible on the page and I can find its unique relative XPath ...
-1
votes
3answers
767 views
Retrieving an XPath Text from a Web Element [closed]
I have a task where I need to retrieve the following text in black color highlighted in yellow. It is not within any tags and has no attribute. Once you locate a web element through the Inspect option,...
1
vote
1answer
79 views
How to get xpath of only the categories for checkboxes
I am trying to find the xpath / count for all the checkboxes under "Categories".
but when I am trying to get xpath/count it is getting me all the checkboxes under "Categories" and under "Brands"
How ...
0
votes
4answers
319 views
Not able to find the unique xpath for an element in expedia.com using Selenium
I am trying to find the unique xpath for elements in the "travelers" pop option in the home page of expedia.com
When I give the following xpath "//div[contains(@class,'gcw-menu')]/div/div1/div2/div[4]...
0
votes
0answers
37 views
Unable to find the xpath [duplicate]
I am unable to find xpath for the below success message:
WebElement successOverlayMsg = findElement(By.xpath("//*[text()='A new app overlay \"APAutomation_Merchant_M32XphDFc\" has been created ...
0
votes
0answers
28 views
How to apply a 'Loop' to map the row element where XPath changes whenever page get's loaded [duplicate]
How to map on to a particular row element say " NCC "where the number of the row containing that element changes whenever page get's loaded.
Reference website-guru99
for(int i=0;i<19;i++)
...
0
votes
1answer
894 views
Cannot find an element with Xpath in Appium
I'm new to Appium. Sorry if the question is duplicated, but I did not find the solution.
I have a problem - I cannot locate an element using Xpath, but I have no problems locating it using the ID ...
-1
votes
1answer
67 views
How can I pass/use a parameter1 value into another parameter2 xpath? [closed]
How can I pass/use a parameter1 value into another parameter2 xpath ?
0
votes
7answers
294 views
How to handle changing absolute XPath?
/html/body/div/main/div/div/div[2]/div/div/div/div[1]/div/div***[4]***/div/div[2]
The div[4] element keeps changing. If a new item comes into the web, the div number changes.
How do I handle this?
0
votes
1answer
67 views
Finding an item in a table - Selenium scripts
I need to select/click an item from the table. I'm new/beginner to selenium. when I inspect the individual property, it has:
<a id = "rpn" style=ācursor: pointerā, ng-click=āgrid.appScope....
1
vote
2answers
969 views
How to resolve 'Cannot convert from void to WebElement' error in Selenium
I am getting below error:
Error:
Type mismatch: cannot convert from void to WebElement.
CODE:
WebElement uploadElement = (driver.findElement(By.xpath("//input[@id='HorizontalLogoPath']"))).click(...
1
vote
3answers
5k views
Stale element reference: element is not attached to the page of the document
I would really appreciate if someone could help figure out what the hell is going on with one of my tests.
I'm getting Stale element reference: element is not attached to the page of the ...
2
votes
0answers
37 views
How to handle n number of dropdowns fields with same xpaths [closed]
I have two drop down fields that are parallel and there is a button as well from where more fields can be added at every row. There is no limit on the fields to be added and have to fetch values from ...
2
votes
1answer
859 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')]"...
2
votes
0answers
121 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 ...
1
vote
3answers
324 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?
1
vote
1answer
355 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() ...
-1
votes
1answer
89 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-...
3
votes
2answers
199 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 ...
0
votes
1answer
39 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....
0
votes
3answers
633 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
911 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 ...
0
votes
2answers
61 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?
1
vote
3answers
395 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
381 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 ...
0
votes
1answer
411 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,...