Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
1answer
22 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
35 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
26 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
38 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
38 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
63 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
24 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
58 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
29 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
52 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
59 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 ...
3
votes
2answers
97 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
77 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
40 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
44 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
60 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
59 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
85 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
84 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
48 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
97 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: &...
2
votes
1answer
257 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
65 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
230 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
37 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
61 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
116 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
37 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.cfm?...
0
votes
0answers
42 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
91 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
84 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
169 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
3answers
336 views

How to find element with li class inside span class in Selenium

Its name of tab. I have tried by Link-text but it's not working. I have tried d.findElement(By.linkText("Clauses")).click(); It shows error Exception in thread "main" org.openqa.selenium....
1
vote
1answer
55 views

(C#) Selenium: How do I choose an option within a ComboBox?

How do I select the "C" option of my ComboBox "opcao_pesquisa"? <form name="Form1" method="post"> <input type="hidden" name="operacao" value="1"> <input type="hidden" name="d" ...
0
votes
1answer
39 views

xPath (SCRAPY) Python using two attributes together

For example : <html > <body> <a class="abcd" title="he is Gandhi"> he was good </a> <a class="bcde" > he was very good </a> <a class="abcde" title ...
2
votes
2answers
56 views

Selenium: How do I use the button of my HTML in WebElement?

How do I locate my button that has the text Pesquisar > in my Selenium WebElement? My HTML: <div style="font-size: 10pt; font-weight: bold">Portais </div> <hr> <form name="...
0
votes
1answer
32 views

Tidy HTML with BaseX

How do I tidy this HTML for baseX? Working from a basic example. Looks like the HTML isn't valid, or at least baseX has apparent problems with parsing it: thufir@dur:~/NetBeansProjects/...
1
vote
1answer
51 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 ...
2
votes
0answers
73 views

decompose an HTML list with page fragments

note: Looking for simplest possible example of PageFactory and fragments. I've been referencing an article which uses additional libraries I wasn't aware of. The desired structure: Where there's ...
1
vote
1answer
90 views

how to Iterate a List of links?

This "Books" link shows that it has the following xpath: /html/body/div/div/div/aside/div[2]/ul/li/a Then follows the catalogue categories: Travel, Mystery, etc. Reading the xpath above I see ...
1
vote
2answers
246 views

NullPointerException when using @FindBy

I'm getting a NullPointerException when trying to use @FindBy because the object reference is only declared and not instantiated. What is the usage? The docs give example declaration but no instance ...
0
votes
1answer
142 views

xpath query for specific String value

My project is crashing with: Element info: {Using=xpath, value=//a[contains(text(), 'Books')]/@href}. The output (crash): thufir@dur:~/NetBeansProjects/com.toscrape.books.selenium$ thufir@dur:~/...
1
vote
3answers
1k views

XPATH : text()='BUY NOW' is working but not contains(text(),'BUY NOW')

In Flipkart page, I searched for Apple ipads and clicked on first search result. Here, I wanted to click on 'BUY NOW'. Typical page looks like this: I used the following xpath and it worked: //...
3
votes
2answers
108 views

How to find the xpath for the link given below?

Please help me find the xpath for the page https://www.seleniumhq.org/download/ In this page there is a para "Selenium Standalone Server". In that I have to find the xpath for Download version link "...
1
vote
1answer
61 views

How to speed up Java Selenium Script,with minimum wait time

I'm currently working on a java selenium Project, which is usually a small script where I have to check for each element for it's presence and based on that some actions are triggered but our main ...
2
votes
2answers
79 views

How can we automate the fields if there are multiple data components are present on UI and we need find inside elements

I am new to selenium. following are some info. Can someone guide me to create xpath and this is the approach we are using to maintain the UI elements unique, so for this code, will selenium help to ...
0
votes
1answer
850 views

how do I get text value outside of any tag in html, through selenium in java

I have text,which is not enclosed inside any of the HTML tag but is wrapped in between two HTML tag as shown in below image, how do I get the value 38 in this case, through selenium in java. below is ...
0
votes
2answers
108 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 ...
0
votes
2answers
128 views

Selenium: Why find_element_by_partial_link_text finds the first match only?

What I want to do: I want to click all the links where partial text = "105611A5C7B9_Logs_" Example: First Link Text = 105611A5C7B9_Logs_11-15-18-06-04PM.tgz Second Link Text = ...
1
vote
5answers
2k views

XPath to select label plus hidden radio button option using WebDriver

I am unable to write the correct XPath to select the title "MRS" for below code. I am using below code, but unable to execute it. driver.findElement(By.xpath("//div[@value='MRS']")).click(); Getting ...