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
2answers
2k views

How to handle xPath returning Boolean instead of element?

I have xPath which returns boolean:true instead of finding an element on the page. Test page has a table with 2 columns and multiple rows. I'm testing if the rows have correct values. Below is the ...
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
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<...
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
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 ?
0
votes
7answers
101 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
3answers
3k views

Can't send values using sendKeys function in Selenium

This is the html line for field I am trying to locate: <input class="textbox" name="txtUserLoginID" maxlength="25" value="" type="text"/> My XPath is: WebElement username = driver.findElement(...
0
votes
2answers
6k views

How to find a button using both xpath and button text?

I have three buttons withing a div. All three buttons belong to same class (class names are same). What I want to do is capture each button using its text (Buttons have different texts) and xpath of ...
0
votes
2answers
157 views

Can any one explain this xpath

Anyone can you please explain this xpath please. why we use '"+filterBy+"' rather than "+filterBy +" in this code segment. (I just simplify the code.this not an original one.) String filterBy = "Hio";...
0
votes
1answer
3k views

How to handle web element(enable button) having same Xpath?

I am working on a web page which having 3 web elements with 3 enable buttons and all buttons having same Xpath.so my need is to click on the button A and print the title of the webelement on every ...
0
votes
1answer
2k views

Locating Inner Text with CSS or Xpath in Amazon

I am teaching myself automation with Selenium web driver, and thought a good way was to learn off an ecommerce site such as Amazon. I am trying to locate inner text with CSS and used the following to ...
0
votes
5answers
480 views

Unable to locate element using XPath getting NoSuchElementException

I am unable to click on logout link in my web page using XPath. XPath: html/body/div[1]/span/div[1]/a[1] I See my code in an attachment: .
0
votes
5answers
1k views

How to locate “Login” button of Flipkart bootstrap login page? I tried in many ways, but still unable to locate element

Below are three options I tried, but I'm not able to locate Login button. When I tried using seleniumIDE, I got this xpath=(//button[@type='submit'])[2] But its not working in Webdriver. Can someone ...
0
votes
1answer
2k views

Xpath is not working using contains and starts with having random values

XPath is not working using contains() and starts-with() functions for below ID id="u_0_3" I have tried with: //*[starts-with(@id,'u_')] - startswith //*[contains(@id,'u_')] -contains Can ...
0
votes
1answer
6k views

Matching multiple classes with an XPath expression

I am trying to automate the Scenario of NSE India https://www.nseindia.com/. I am trying to capture the Nifty50 increment or decrement value using Xpath as //nobr/span[@class='red'][1] when sensex is ...
0
votes
1answer
112 views

Are SelectById, SelectByClass and SelectByName just special cases of general SelectByTag?

2 questions in 1: 1) In all the Selenium tutorials they divide the ways of finding elements in the way like: 1. By ID 2. By CLASS 3. By NAME 4. By TAGNAME 5. By CSS Selector 6. By Link 7. By XPath I ...
0
votes
3answers
91 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
1answer
51 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
1answer
36 views

How do I find xpath for “Invalid License!” text in the HTML code shown

<div id="content" class="content"> <div class="container col-lg-12 col-md-12 col-sm-12 col-xs-12"> <div class="alert alert-danger alert-dismissible" role="alert"> <button ...
0
votes
3answers
477 views

Unable to click on link - no element found exception using Java selenium webdriver

I am using Selenium webdriver with Java. I need to click on link - Register New Consumer. HTML: <a href="/int/cdms/registrationType.do" target="_self">Register New Consumer<br> ...
0
votes
2answers
3k views

How to get count of dynamic 'div's' nested inside a each 'td' tag?

I have table which have several <td> tags, again these tag have nested <div> tag. But the number of <div> are dynamic. Means, for each <td> tag number of <div> are ...
0
votes
2answers
2k views

Not able to locate the web element with partial xpath and text [duplicate]

I have web element set like below .. <div class="dxnb-headerCollapsed" id="ctl00_LeftPanel_LeftNavigationMenu_nbMenu_GHC1"> <i class="fa fa-handshake-o fa-2x fa-fw" style="">&...
0
votes
6answers
16k views

How to find XPath inside <td>

I need to find the xpath for the line in the image with highlighted text. The highlighted text/number is dynamic. Once I find the xpath, I can save it in a variable using getText(). Kindly help me. I ...
0
votes
1answer
25 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 ...
0
votes
1answer
41 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....
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
1answer
49 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
3answers
97 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 ...
0
votes
2answers
410 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
3k 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
1answer
210 views

Unable to click a delete icon represented in my cart

Here is my HTMLCode: <span onclick="cart_delete('0')"> <i class="fa fa-trash-o" aria-hidden="true"></i> </span> I tried with below code: driver.findElement(By.xpath("//span[...
0
votes
1answer
143 views

Finding xpath using tr/td

http://newtours.demoaut.com/mercuryregister.php Find xpath for first name and last name is very difficult. How Xpath can be used if there is no id , tag or class available. ...
0
votes
1answer
69 views

Locating unique element from a set of elements that only differ by a random string contained in the id attribute

I am trying to locate and loop through a set of elements that contain an id that only differs by a contained string. This contained string is not known prior to the test. My current attempt is to use ...
0
votes
1answer
826 views

C# Selenium - How to write a conditional statement with multiple elements/xpaths

I have a problem and having trouble to finding a solution. Problem Statement: Navigate to a webpage and check if three checkboxes are selected. If not, I'd like to select them (if only one is ...
0
votes
2answers
978 views

How to identify elements on DOM without using element name

<span class="" data-aura-rendered-by="2565:0">Active</span> <!--render facet: 2567:0--> <!--render facet: 2568:0--> </label> == $0 <input type="checkbox" checked="...
0
votes
2answers
353 views

How to get the number of buttons within a div using webdriver?

I have trying to get the number of buttons(count) enabled in a web page using their class names. But I couldn't get it as I wanted. Always I get count as 0. int count = 0; try { ...
0
votes
2answers
112 views

How to find an element which doesn't have proper attribute

I need to click on an element which is inside the div tag. I tried using the xpath which when used detects the element both in console and in the Katalon ide. But when the script is run, it doesn't ...
0
votes
2answers
3k views

Button click is not redirecting to next page in selenium webdriver

I am trying to do Bus Search first on Travelyaari.com and then Modify the Bus Search, The Modify Search button seems to be clicked, however, previous Bus search result page is getting loaded and my ...
0
votes
2answers
10k views

Unable to find the element in selenium web driver

I am trying to run the below code but getting error. Can you please point out the issue import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa....
0
votes
1answer
6k views

How to get the XPath for all tables in a page?

How do I know or find the xpath for table? Or, even better, get the xpath for all tables in a specific page? I'm getting no_such_element when running: public void test() { String ...
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 ...
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("...
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....
0
votes
2answers
1k views

How to get unique xpath with dynamic @id? [duplicate]

Hi I am facing problem to identify cause @id is dynamic :- //div[@id='SubmissionWizard:LOBWizardStepGroup:LineWizardStepSet:WC7LineCoverageScreen:WC7LineCoverageCV:WC7ConditionsDV:5:CoverageInputSet:...
0
votes
2answers
2k views

XPath not recognised in page object model in WebDriver [closed]

xpath not recognised in page object model in webdriver. @FindBy(xpath = "//td[contains (text(),'xxx')]") public WebElement topMenu; topMenu.click(); Error: Unable to locate element: {"method":"...
0
votes
4answers
48 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
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
2answers
108 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
1answer
56 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
160 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,...