All Questions
Tagged with automated-testing xpath
131 questions
0
votes
0
answers
22
views
How to resolve Null error displayed for shadowRoot element?
I have written this code in which I am able to get the shadow element:
package org.example;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa....
0
votes
4
answers
537
views
Selenium Locators are not working for this site?
public class LoginPage {
WebDriver driver;
@FindBy(xpath = "//input[contains(@class,'oxd-input') and @name='username']")
private WebElement userName;
@FindBy(xpath = "...
0
votes
1
answer
91
views
How to find an unnamed button belonging to a certain h2 entry XPath
(I am a bit of a StackOverflow newbie, so please forgive any beginner mistakes and let me know what to improve in the future)
I am trying to select the highlighted button in the appended picture.
...
-1
votes
1
answer
74
views
I want to select a checkbox, how to obtain a xpath for the picture below anyone?
Please help me with the xpath for the above picture to select a checkbox?
0
votes
2
answers
97
views
How to find xpath of "BBB element in following example?
I am unable to find xpath of "BBB" in following span class example.
<span class="xyz"> "AAA" "BBB" "CCC" ==$0 </span>
0
votes
4
answers
7k
views
Selenium - How to remove   from my text value
I am trying to use this xpath to find the number of elements that have a value between X and Y. The problem I am facing is since there is   in the HTML, and the code doesn't detect the text ...
0
votes
1
answer
2k
views
Selenium - cannot click on radio button
I have tried all the possibilities but am unable to click the radio button Yes or No. It would be great if I get some help. I have observed that Need to take this attribute (<span radiogroup class=&...
1
vote
2
answers
335
views
Unable to capture the element using xpath
I'm trying to capture the dynamic code using xpath(Selenium+Java).
I want to get that code and store it in a variable, but it always returns no such element exception.
My xpath looks like below when ...
0
votes
3
answers
3k
views
How to pass text dynamically in xpath under Properties file
I am stuck in a situation where I want to write Xpath dynamically in the properties file. The actual XPath is like in property File div[contains(text(),'<state Name>')]. State Name changes ...
0
votes
1
answer
2k
views
How to find all child elements inside a WebElement or List of WebElements in Selenium?
I have a <section> tag in which there is <tfoot> tags and many <td> tags.
I want to store the 1st & 4th td elements of a in a Map, but i get index out of bounds exception.
Now, ...
1
vote
1
answer
3k
views
RobotFramework: Link/List with locator not found
I am studying Robot Framework with Selenium Library and I can't figure out how to remove "kw" element from the next dropdown:
I tried to use xpath for it:
*** Settings ***
Library ...
1
vote
1
answer
633
views
Automating a comment delete on FB with Selenium
I am trying to automate deleting my old comments on posts I've made on FB.
Im using Selenium with python to achieve this.
I am currently having trouble dealing with pressing the hidden buttons (1 &...
0
votes
1
answer
50
views
How do I write a better xpath of this element? [duplicate]
I am working on a project and building automation test suite for a webpage. A certain part of the webpage looks like this.
The corresponding HTML is as follows:
<p class="customer-service&...
0
votes
1
answer
1k
views
Error: Exception in thread "main" java.lang.NumberFormatException: For input string: ""
Scenario: I am using Selenium Java. I need to add items to the cart and calculate the total price of the items in the cart.
Url: https://rahulshettyacademy.com/seleniumPractise/#/
Issue: My code is ...
2
votes
1
answer
2k
views
The instruction (Keys.ARROW_DOWN) is moving the cursor to the bottom of the dropdown list instead of the first option
Scenario: To search and select the first destination location that matches the input string using the below code.
Code snippet:
driver = new ChromeDriver();
driver.manage().timeouts()....
2
votes
1
answer
421
views
The value from the table is different using Xpath and CSS selectors
Test url=https://www.cricbuzz.com/live-cricket-scorecard/22585/aus-vs-nz-1st-odi-new-zealand-tour-of-australia-2020
I am trying to get the title of a table using the below code:
Code snippet:
...
0
votes
1
answer
3k
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 ...
2
votes
2
answers
3k
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
votes
1
answer
415
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
2
answers
83
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?
2
votes
4
answers
3k
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
1
answer
933
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
1
answer
57
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
3
answers
4k
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 ...
1
vote
3
answers
5k
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
2
answers
199
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?
1
vote
2
answers
17k
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[...
1
vote
1
answer
3k
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 ...
1
vote
2
answers
75
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
3
answers
6k
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:
&...
0
votes
1
answer
175
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
2
answers
530
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']"))....
2
votes
2
answers
288
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
2
answers
270
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="...
2
votes
2
answers
124
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
2
answers
3k
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
2
answers
2k
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</...
0
votes
2
answers
1k
views
Unable to locate Text element using XPath in Selenium [closed]
This is my HTML page and I have some problem with my automation code and it is not able to locate the element and this is the XPath I used:
@FindBy(xpath="//div[contains(text(),'Done')]")
HTML Code:
...
0
votes
1
answer
793
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
3
answers
1k
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
1
answer
90
views
Sharepoint Automation
I am trying to automate SharePoint test cases. I am finding an issue while finding an element locator for actual result, updated by, update date. Does anyone know how to find the locators?
HTML:
<...
1
vote
2
answers
3k
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>...
0
votes
1
answer
18k
views
How to resolve InvalidSelectorException in Selenium?
selenium.common.exceptions.InvalidSelectorException: Message: invalid selector
Unable to locate an element with the xpath expression .//*[@id="Toolbar"]/table/tbody/tr/td[2]/a[1]/span)[3] because of ...
0
votes
2
answers
1k
views
Verify Text using CSS or Xpath
I am new to automation, Selenium Web Driver and am practicing code using Amazon. I want to verify my logged in user name (Hello, Nichole) on the Amazon Home Page but anything I enter using CSS or ...
0
votes
1
answer
12k
views
Getting Invalid Element State Exception
I am trying to clear text from <div> section using XPath using the below line.
Clear Element Text xpath=//*[@id="intro-overlay"]/div
I am getting below Error:
...
1
vote
2
answers
8k
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
2
answers
7k
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 ...
-1
votes
1
answer
3k
views
How to create Xpath to read text between span class?
HTML:
...<div class="ArticleCount__articleCount___lQ5f1">
<span class="ArticleCount__text___1c2Rn">Showing</span>
9
<span class="ArticleCount__text___1c2Rn">of</span>
23
...
-2
votes
3
answers
8k
views
Unable to find the element using XPath
XPath: //*[@id=\"clB\"]/div[1]/div[1]/a/div
Exception:
Exception in thread "main" org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath ...
1
vote
3
answers
78
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 ...