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
0
votes
1answer
332 views

JMeter - unable to return correct argument from list in XPath extractor

In order to generate HTTP requests to open a particular window, I need to obtain the component ID which is nested as an argument in onmousedown="Console.openView()" - in this example componentId= 1325....
3
votes
2answers
219 views

Identifying if an element is present or not using selenium

I have a SAVE button which is active only if I do some changes and then trying to save it. Otherwise its disabled. This is the html for that button: <button id="customize-site-save" class="...
2
votes
3answers
740 views

Clicking on a Xpath

I have a back button on my web page which I need to click on from different places. In one page the back buttons xpath looks like: //property-list/ion-header/ion-navbar/button In another other page ...
1
vote
2answers
586 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 ...
4
votes
5answers
18k views

How to locate an element which is visible only by mouse hover in selenium webdriver

I want to find an element which is visible by mouse hover and I need to click on it and it then opens a text field. When I give the XPath for the element in fire-path, it detects 6 instances of the ...
4
votes
2answers
1k views

Dynamic XPath in Selenium - which input field keeps changing

I tried to find the XPath of a text field username and password, but it keeps on changing dynamically. I won't be able to use starts-with or contains in a findelement using XPath. Here's the HTML DOM- ...
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"); ...
4
votes
4answers
7k views

How to click a link when more than 1 exists?

I want to click the link in one container but the container contains two links having the same identifier. For example: <div id="container" style="height:88 px; width: 310px;"> <a class="...
2
votes
4answers
4k views

Selenium — How to deal with 2 submit buttons and click on one of them?

The key HTML is: <div class="col col3 actionCol"> <button type="submit" class="booking fRight">Book</button> </div> but we also have other forms on the same page, e.g. for ...
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. ...
2
votes
1answer
4k views

Unable to click button Selenium Webdriver 3

I have a button I want to click, Selenium isn't giving me an error just stops. I've tried both xpath and css and it just stops. <a ng-click="login();" ng-disabled="loginForm.$invalid || ...
0
votes
1answer
4k views

Java + Selenium + Frame :How to interact on element inside frame? [closed]

Problem - I've been trying to find the correct xpath for a element. I couldn't get the element in correct manner. Observation - I observed, It may be due to the element is located inside or under ...
1
vote
0answers
788 views

Hover Function not working in selenium webdriver for IE 11 browser [closed]

In IE 11, mouse hover is not working.It is kendo-control.Tried with each possible way.But anything is not working.The element is getting highlighted but it is not opening the list. I want to hover ...
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()='...
4
votes
3answers
345 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
858 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 ...
4
votes
2answers
366 views

Localization of Ranorex XPaths

Our application is available in German and English, other languages may follow. Given I have an XPath like /form/button[@text="Login"], is there a convenient way to have it translated? At the moment ...
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
375 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
2answers
888 views

Identifying objects in Selenium

I have been asked on interviews about identifying objects, so I got a little confused. All of the below questions are related to identifying elements, so I combined them together: Is there any other ...
2
votes
1answer
2k views

XPath 'following', 'preceding' method equivalent in CSS selecor selenium

I am converting my project element library from xpath to CSS. Some xpath expression written using 'following' and 'preceding' method. Like below. //div[@id='dashboard_right_now']/following::a[...
3
votes
3answers
68k views

How to find element by class name or xPath?

I have problems with finding this element: I tried these finders: IWebElement profilUploadPhoto = driverGC.FindElement(By.XPath("//button[contains(.,'submit')]")); IWebElement profilUploadPhoto = ...
0
votes
2answers
510 views

Selenium is not recognizing xpath

When I attempt to search for the following element by XPath, Selenium does not find the the element. Not sure what I'm missing here. driver.FindElement(By.XPath("//input[@type='text']")).SendKeys("...
3
votes
2answers
3k views

What is the hierarchy to use for finding elements - ID, class, name, xpath?

What is the hierarchy to use 'find element' by ID, class, or xpath and so on. Which is preferred over which? For some elements class is being used - is that recommended?
1
vote
1answer
183 views

Which is more efficient mechanism for Object Identification in QTP - Xpath or Ordinal Identifiers?

Which is more efficient mechanism for Object Identification in QTP - Xpath or Ordinal Identifiers ?
3
votes
3answers
7k views

What do I need to do if dropdown takes more time to populate 1st element from dropdown list?

What do I need to do if drop down take time to populate 1st element from drop down list? Select Cdropdown = new Select(driver.findElement(By.xpath("//select[@id='ClientId']"))); Cdropdown....
4
votes
6answers
12k views

How to locate an element which is inside the iframe?

I'm new to automation testing (I'm using TestNG framework and Java language) I'm having trouble in locating an element which is inside iframe. WebElement iframeSwitch= driver.findElement(By.id("...
2
votes
2answers
223 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&...
17
votes
5answers
61k views

How to handle dynamic changing ID's In XPath?

How to Handle Dynamic Changing IDs In XPath? for example : //div[@id='post-body-3647323225296998740']/div[1]/form[1]/input[1] In this xpath id "3647323225296998740" is changing every time when ...
1
vote
1answer
360 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="...
2
votes
4answers
182 views

Selenium- Unable to save dynamic paths in the list..list shows 0 as size

import java.util.List; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium....
0
votes
3answers
2k views

How to handle selectors that have ID's that keep changing? [duplicate]

I am using Fire bug in firefox browser to identify a unique id in the web pages using the Xpath feature. Sometimes the Xpaths are not unique, ie: the xpath id is dynamic and keeps changing as the ...
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 ...
2
votes
2answers
7k views

How to verify no /tr /td rows exist in a table?

I am verifying text using these Xpaths, $I->CanSeeElement("//tbody[contains(tr/td/div/table/tbody/tr/td[1]/text(),$this->Secondarycustomer)]"); $I->CanSeeElement("//tbody[contains(...
0
votes
2answers
608 views

Selecting element by xPath vs. class vs. byId

Selenium WebDriver provides numerous ways to select an element as shown in googledocs (under "implements interfaces"): by class name by id by xpath etc. Is there one that is more "resistant" (i.e....
4
votes
4answers
3k views

How to generate good locators for elements in Web pages?

This site contains many questions that are about finding the right locator expression (XPath, CSS, etc) for an object in WebPage or about troubleshooting problems related in invalid or dynamic ...
2
votes
7answers
7k views

How to find the xpath locator for logout button?

We are currently working on a selenium project. Can you guys help me to find the xpath locator for the logout button in the application? Below is a screenshot of the code for the element for which I'...
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
1answer
16k views

Can't click a button [Python + Selenium]

I'm writing a program to automate some actions on a website using Python and Selenium and I need to click a button with this code: <button class="button login" data-popup="login">Change User<...
2
votes
1answer
403 views

Assertion about size of an XML tag

Community, I'm trying to add an assertion for an XML Response that verifies the size of the info of one of the tags. So for example, this is my response: <description>This is your password</...
2
votes
2answers
2k views

AND/OR Operation in Contains Assertion in SOAP UI

There's one tag in my XML response whose elements (JSON Data) always come in different order. Is there any way to create a contains assertion with AND/OR operations or should I just use a Script ...
3
votes
3answers
4k views

Correct CSS selector for selenium

Which css selector's correct for the following HTML code ? <li class="active editing" data-index="0"> <div class="view"> <input class="edit"/> </li> I'm trying to get ...
2
votes
1answer
33k views

How to use multiple condition in xpath?

I have tried with the xpath like "//HTMLtag[contains(text(),'Yourtext') and contains(text(),'Yourtext')]", but this case worked for the particular html tag and not for the different tags. how to make ...
2
votes
2answers
5k views

How to add HTML/text content of a <div> into an array/list?

I am new to selenium and working with xpath. I am using selenium and java to write automated tests for chat messaging web application. I am looking for a way to take a webElement which contains ...
4
votes
1answer
188 views

How to pull content of a div into a String

I am looking for a way to pull the html or text content of a so I could work with it for a method which validates links amongst text of messages displays on a webpage. I am using selenium and java. ...
8
votes
4answers
74k 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 ...
4
votes
1answer
16k views

Using xpath to confirm <h4> text with a <strong tag> in the middle

I'm using the Java Selenium WebDriver implementation. I'm searching for a string literal in an tag which has a tag in the middle, i.e. <h4>Some regular text <strong>followed by strong ...
0
votes
1answer
125 views

Finding column with certain text works using xpath but fails with cssSelector

I was trying to locate table column containing text 'Name', and it fails while using cssSelector with 'Unable to locate element' but works with XPath. I tried all the 3 below options with different ...
1
vote
2answers
202 views

Webdriver Java : How to identify two identical Ajax Control using xpath

WebApplication has Calender Ajax Control twice on same page. I cannot use id's as ids get generated by Ajax call dynamically . So identifying it using xpaths and classnames. I can identify First ...
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 ...