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
votes
1answer
46 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
75 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
37 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
47 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
2answers
108 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
32 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 ...
2
votes
1answer
45 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
115 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
83 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
85 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
38 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
1answer
72 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
81 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
97 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
52 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
96 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
35 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
139 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,...
1
vote
1answer
35 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
1answer
48 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
2answers
43 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
0answers
281 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
1answer
33 views

Unable to find the element within frame

i cant click the menu named biometric check list. there's total five frames and i started to read it from first index. getting unable to locate an element error. What might be the reason any idea. ...
0
votes
3answers
576 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 ...
0
votes
1answer
47 views

how can i capture src in xml by using cssSelector or Xpath?

how can i capture src in following xml by using cssSelector or Xpath ? <INPUT src="/TelsimGlobal/Menu/image3.gif" type=image> i tried to execute following ones but always faced with "Unable to ...
0
votes
1answer
105 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//...
1
vote
3answers
252 views

Select element by containing text without XPath in Selenium

There is a great discussion on what makes a good Selenium locator here. It seems many testers prefer CSS to XPath for locators, for various reasons. And that goes for me, too. But, it is often ...
2
votes
2answers
101 views

What is the best way to automate a system, where the XPath is not static?

I have to automate a system, which changes its ID's from time to time, and the XPath is not static. What is the best way to automate this kind of system?
0
votes
2answers
429 views

How can I use selenium to get the last element in a list?

I have such a structure How does it look visually I'm trying to get the last item and click on it, but the 4th item is selected. driver.findElement(By.xpath(("//*[@id=\"page-body\"]/div/div[2]/ul[...
0
votes
1answer
69 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 ...
0
votes
0answers
46 views

Problem facing to automate city auto suggested field when html structure is complex

I have tried many different XPATH but still I am not able fetch city from displayed list and perform click on it.I have posted this question earlier also suggested answers couldn't help.With my code ...
1
vote
2answers
63 views

What is the correct Xpath for this element?

I need to get the text inside the element and I am using Inner HTML, in Java Selenium but all the xpaths and css selectors written by me, are wrong, can you help me to get the right one please? Also ...
0
votes
2answers
86 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, ...
0
votes
3answers
95 views

facing difficulty to create dynamic xpath for City field of UTest website

I am beginner in automation field, I am trying to automated one of the module, I have tried many different XPATH to fetch proper XPATH for City field o UTest site. Im trying to automate registration ...
1
vote
1answer
930 views

Unable to get the element using the text containing line break

I need to get the span element by matching its entire text which has a line break. Below is sample HTML: <div class="class1"> <a> <span>fourth<br>team</span>...
1
vote
1answer
52 views

Same Xpath expression returns different results

I understand that for the below xml the xpath expression "//span[position()=1]" returns the first span element anywhere in the document: <div> <span>qty</span> <span>price</...
0
votes
3answers
428 views

Unable to click on Xpath element even the correct path

Unable to click on Xpath element even the correct path,tried with Webdriver wait and Javascript executor still no use. My code: driver.findElement(By.xpath(".//*[text()='Next']")).click(); Page: &...
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=//...
0
votes
0answers
152 views

Writing selenium tests againgst bootstrap Checkboxes

I have currently a big Problem to click on a Checkbox in a bootstrap designed GUI. In Html it appres like this: Does someone know how to press the Button of this checkbox? Because the controls are ...
0
votes
1answer
2k 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 ...
0
votes
1answer
45 views

Find element and click on it in a complex structure

I have following structure on my web-site. //New Box <div> <div> </div> <div> <div> <div> </div> <...
1
vote
2answers
135 views

The xpath in selenium can not locate the path

I'm trying to add some text to a textbox in my html but the xpath cannot find the path and I don't know why. this is my code: PropertiesCollections.driver.FindElement(By.XPath("//*[@id='from0']"))....
0
votes
2answers
372 views

Selenium with Google search results

When you search for something in Google and get the results, it is not easy to locate the elements, using Selenium, since Google uses classes like <div class="kno-ecr-pt kno-fb-ctx gsmt"> ...
0
votes
1answer
68 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
0answers
45 views

Verify links in article within the web page / selenium web driver

I have to verify the links mentioned in article within web page. There are too many links in the page but I have to verify just the links specified in the article content. https://techcrunch.com/2019/...
0
votes
1answer
371 views

Dynamic XPATH by for loop in selenium web driver

I'm trying to write dynamic XPATH by for loop in java selenium WebDriver but I couldn't do it. There's a webpage and I have to print the string content which are in the xpaths mentioned in follow. /...
2
votes
2answers
100 views

How can I find element and insert text on this page?

The problem is that I cannot find and enter the text in the fields <input onkeyup="$('#firstname').val(this.value);" type="text" class="is_required validate form-control" data-validate="isName" id=...
2
votes
3answers
741 views

(C#) Selenium: How to extract information from html and write to a variable

I want to know how to get the HTML tag information and write to a C# project variable. Remember that I can not change the HTML because I do not have access. In the example below, it is necessary to ...
0
votes
4answers
624 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. ...