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
1answer
7k views

How to get nested web element in dynamic table using xpath

I have a table which is dynamic (so i can't use strict locator or paths) <tbody> <tr class="odd" role="row"> <td>Company</td> <td class="sorting_1"> <td>22222@...
1
vote
3answers
91 views

Notion of dynamic element

After watching videos on dynamic x-path in Selenium I want to ask: Q1: what does "dynamic" actually mean? Does it mean that the value changes at runtime or it can change over a period of time with no ...
1
vote
3answers
224 views

How to validate xpaths in selenium over scripts

I am new to Selenium. I heard that in real time we will not use xpaths generated by tools..rather we will write our own. So i decided to learn writing xpaths. Can u please suggest how to practice ...
1
vote
1answer
8k views

How to write xpath with variable?

I have an xpath: //*[@id='00QE000000gQ9fv_ACTION_COLUMN']/a[2]/span in this xpath 00QE000000gQ9fv is dynamic and _ACTION_COLUMN remains the same. I stored 00QE000000gQ9fv in a String variable as ...
1
vote
2answers
158 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']"))....
1
vote
1answer
106 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" ...
1
vote
1answer
194 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
788 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 ...
1
vote
2answers
442 views

The xpath for clicking edit button is not working in Selenium Java

HTML Code: <button onclick="root.handleOnClick( document, this );" id="Edit_edit::0" title="Edit" name="Edit_edit::0" class="navbar-btn btn btn-default btn-sm cs-btn" type="button">Edit</...
1
vote
2answers
850 views

Can we use css properties (like background-color) for locating an element when that property is not part of the element attributes

Can we use css properties (like background-color) for locating an element when that property is not part of the element attributes? Like If I have to get the xpath or css of this element, either I ...
1
vote
3answers
63 views

Locating element on DOM pages when element type changes, e.g. INPUT to A

//a[@type='text'][contains(@class,'form-control')][contains(@name,'projectsurvey')] Do we have a way when the element name changes from input to some other For Example : class then definitely script ...
1
vote
1answer
425 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 ...
1
vote
1answer
2k views

Selenium fail to find the html tag inside iframe after selecting the frame

I am trying to edit the message body area of outlook mail. The steps I have followed so far are, Login to outlook web app Double click and open the mail (the mail is opened in a seperate window) ...
1
vote
1answer
403 views

NoSuchElementException: Cannot locate an element using XPath

I am getting XPath error. Already tried with many XPath's. But not able to resolve. Can anyone give correct XPath? XML: <form id="report-filter-form" class="report-filter-form" accept-charset="...
1
vote
4answers
10k views

How do I use a combination of attributes to select a button in Selenium?

I'm trying to get selenium to select a simple button that says next. I've tried XPath, CSS, and linktext and it still will not select it for me saying it cannot locate the element. Here is the code. ...
1
vote
1answer
67 views

What are the debug tools that i can use for GUI Automation on Internet Explorer?

Are there any tools similar to firebug/firepath that i can use to test the locators on the internet explorer browser? I was running an xpath which works in firefox but fails in IE.
1
vote
2answers
2k views

Not able to identify tab in Selenium

Below is code for tab - account.This is third tab. I have to go on tab but I am not able to identify <td class="buttons" nowrap="nowrap" title="Shows data of bank account" onclick="document....
1
vote
2answers
193 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 ...
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.
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 ...
1
vote
1answer
1k 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
152 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 ...
1
vote
5answers
4k 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 ...
1
vote
2answers
557 views

How to go to a certain Xpath by Searching a Text in Selenium WebDriver

I have below HTML which is having a table with 15 rows (below are the 2 rows for example)- <table id="task" style="width:100%" class="border"> <thead> <tr> <th>Task </th>...
1
vote
3answers
399 views

How do I get the same result for xpath1 OR xpath2 in Selenium?

How to get the same result if condition: //div[@class='lng-info']/h5[text() = 'PMP'] or condition //div[@class='lng-info']/div[@class='price'] is true ? How do I write a single xpath expression ...
1
vote
3answers
839 views

How to solve java.lang.NullPointerException error in button click event?

I'm using Java,Selenium web driver and TestNG framework. I have a method to click a button in web page. But it didn't work. When debugging I could find xpath is not passed to the button. Then I tried ...
1
vote
2answers
612 views

Unable to click on checkbox using XPath and CSS

I am not able to click the checkbox, I tried some XPath and CSS and id but I am not able to click on the checkbox HTML Code: <div class="row"> <table id="orderNoDropdown" class="table ...
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)) ...
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
86 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
1answer
739 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 ...
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 ...
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 "//*[@...
1
vote
2answers
585 views

How to select an item from a drop down list with same text appearing along with other text

I'm using selenium/java and have a drop down list for languages. This list contains multiple variations of "English" as you can see in the code below. I want to select just "English". I thought of ...
1
vote
3answers
2k views

what type of list does FindElements(ByTagName(“a”)) returns? [closed]

public static void main(String[] args) { // TODO Auto-generated method stub System.setProperty("webdriver.chrome.driver", "C:/Automation Stuff/ChromeDriver/chromedriver.exe"); ...
1
vote
4answers
11k views

Or Conditions in Xpath

I would like to find the Xpath, where the Text contains two names. I want my xpath to identify any one of the conditions below. e.g //div[text()='USER NAME' OR text()='USER ID'] or //div[text()='...
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
1answer
357 views

How can I traverse to a particular element using xpath from a particular node? [closed]

Assume the following DOM fragment: <div id="ctl00_mainContent_ddl_destinationStation1_CTNR" class="search_options_menucontentbg" style="z-index: 999999; display: block;"> <div id="...
1
vote
1answer
493 views

Firefinder doesn't find element but Firebug or Selenium IDE do

I have a problem with finding web elements in my web application. When I use Selenium IDE everything is ok, the element can be found. In Firebug or Chrome developer tools is ok as well (element is ...
1
vote
3answers
10k views

Finding grandparent of an element using xpath in selenium

I want to click the parent of an element if the text within the child matches a certain string. I am using contains to find the text and :xpath,"../../" to find the parent. Here is ruby code: test=@...
1
vote
1answer
855 views

Parsing xpath results in selenium ide

I'm trying to get a list of all the links that follow a certain rule ( their href is Downloads.aspx?<somestring> ) *Note: I'm using Selenium IDE, the Firefox plugin for this. In order to get ...
1
vote
1answer
204 views

How to locate cursors randomly in a map?

There is a lot of cursors in the map. Every time you refresh the map you will get another different cursors with different IDs, o I can't use the IDs. I want to click at any cursor, a tooltip should ...
1
vote
1answer
97 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
vote
5answers
5k 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/...
1
vote
0answers
431 views

Unable to Switch to iframe in IE

Code Trails: driver.switchTo().defaultContent(); List<WebElement> before = driver.findElements(By.tagName("iframe")); for (WebElement t : before) { System.out.println("iframe" + t....
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: ...
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 ...
1
vote
1answer
116 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
0answers
391 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
vote
1answer
36 views

Unable to return both attributes using XPath in JMeter

I have the following xml: <td class="tableCell restrictionCell"> <span class="restrictionEditLink" rId="202">edit</span> &nbsp;<span class="restrictionDeleteLink" ...