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 [selenium2]

Use for questions about Selenium 2. Selenium 2 is the second major release of Selenium, an open source framework for testing web applications. A major difference between Selenium 1 and Selenium 2 is the latter's use of WebDriver.

0
votes
0answers
20 views
-1
votes
2answers
33 views

Either its possible to get and show a value from front end in selenium Java. If so, then how I can do this

I am testing a website and I need to perform some action on the basis of Price. It is showing price in Remaining Budget. I want to check the remaining budget and then on the basis of it want to ...
2
votes
2answers
55 views

if/else condition is not working as expected

WebElement radio= driver.findElement(By.xpath("//[@id=\"mydiv\"]/form/div[1]/div[3]/label")); if (radio.isSelected()){ Thread.sleep(2000); driver.findElement(By.xpath("//*[@id=\"mydiv\"]/form/...
0
votes
3answers
60 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
votes
2answers
60 views

How to interact with web elements with the same ID's?

I have three drop-downs with same ID's and want to click each of them, one by one, but it will click the same element three times. The remaining two elements are failing, but that test case is passed. ...
0
votes
2answers
34 views

is there any possibility to check the button sizes and images are loading or not in selenium?

how can I check frontend button sizes, logos, and images are loading or not?
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?
4
votes
2answers
295 views

How can I handle alert using if else condition in selenium?

else is perfectly executed but if block is not executed - can anyone help me? WebDriverWait wait = new WebDriverWait(Maf_Base.getDriver(), 10 /*timeout in seconds*/); if(wait.until(...
1
vote
0answers
18 views

How to print the webservice(jqurey) hit on the console for search functionality

Open a website, press F12 go to network option and enable preserve log now type the work you want to search eg:dogs we can see the service "http://search.test.com/search........." here i want the ...
0
votes
1answer
29 views

Finding an element by tagname's value

In our app that we are using, there are widgets on the page, lots and lots of widgets. There is a HTML tag called widgetkey in it, with an 'id' value associated with it. Here is the exact HTML: <...
2
votes
1answer
93 views

Selenium exception is reported twice in logs

I am using Cucumber Page Object model to execute my tests. Here is my POM file:- <dependencies> <dependency> <groupId>info.cukes</groupId> <artifactId&...
0
votes
1answer
395 views

how to run same testcase in 2 different URL in selenium JAVA [closed]

How do I run the same test case in 2 different URL which has same functionality
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 ...
-2
votes
1answer
39 views

Double decimal value

public static String TaxAmount(String totprice,String tax) { String strD2=tax; double totalprice= Double.parseDouble(strD2); String strDl = totprice.trim(); if(strDl....
0
votes
3answers
182 views

how to accept Alert message in Selenium Java

I tried driver.switchTo().alert().accept(); but still i am unable to accept the alert message. please let me know the code to accept below message. enclosed screenshot of message and XML
0
votes
1answer
41 views

Fetch paid Amount value from iframe

if(ScenarioName.equals("MoveinwithVantivCard")) { driver.findElement(By.id("btnsave")).click(); // driver.switchTo().frame("paymentIFrame"); driver.switchTo().frame(driver.findElement(By....
1
vote
1answer
247 views

unable to click modal popup using selenium

I Have an application developed using Electron+Chromium when browser launched without any URL there will be a popup. This is a modal popup and using selenium I'm unable to handle this popup. HTML ...
0
votes
2answers
247 views

How to parameterize locator in Selenium

I am new to selenium, And In my scenario I need to select a product for list of products in the page. And Product name to select is a test data. Now my query is,Can I create Object in Class level ( ...
1
vote
3answers
918 views

Multiple @tests but did not execute the priority 2 and priority 3

Can someone let me know why it stops execute after the first @test(priority=1)? It ran the @beforeclass, then @test(priority 1) then @aftermethod. So it skipped @test(prority=2) and @test(priority=3) ...
1
vote
1answer
746 views

How do I use Selenium to drag and drop drawing elements into a canvas?

I have an element with an id which I need to select, then drag and drop into a drawing canvas. How do I do this? The element is outside the canvas and I need to draw it inside the canvas. function ...
-1
votes
5answers
4k views

Unable to click on checkbox using Selenium & Java

please send me the full code I tried Some XPath and CSS: XPath: //div[@id='autofill']/div/label //div[4]/div/label CSS: div.col-md-1.checkbox.checkbox-primary > label* but using above ...
3
votes
4answers
8k views

How to handle browser closing popup

In one of my scenario I am filling the form but not submitting due to my requirement. Now I am closing the browser but while closing browser it is browser an alert by saying "Are you sure .... ". How ...
-1
votes
2answers
2k views

How do I get particular textNode value of a DOM with Selenium

Hello I am trying to find Load # detail from this site. Also You can refer screenshot too. I have tried with xpath : //div[@class='equipment_item']//text()[preceding-sibling::strong[text()='Load #:']]...
0
votes
2answers
241 views

How to handle dynamic submenu items diaplaying based on different user roles in selenium?

I have the following menu structure: Main Menu1 > Sub menu1, submenu2 Main Menu2 > sub menu 1 etc. And sub menus change based on different user. I need to have common method to handle this. ...
0
votes
3answers
1k views

Automation testing of mainframe application using Selenium

is it feasible to test mainframe, which is a desktop based application with selenium? If yes, then how?
1
vote
2answers
453 views

Selenium: Getting error with webElement or Webdriver “Drive” Variable

New to automation. Help is greatly needed Anybody could help me with following code Why i am getting NullPointerException? Error: Null pointer access: The variable driver can only be null at this ...
0
votes
1answer
5k views

Uploading a file to a web site: how to handle Windows dialog to choose a file

Just reviewed questions that may already have the answer, but failed to find anything relevant. So the site I am testing has a file upload dialog. When you click Select File -> Browse, a Windows File ...
-2
votes
4answers
4k views

Button won't click even though I can see it's taking me to the button when doing automation

My code which takes me to the button and highlights it (I'm running java scripts within Eclipse) driver.findElement(By.xpath("//button[contains(text(),'Save')]")).click(); My HTML code <button ...
4
votes
1answer
2k views

How do I validate dynamically changing data using Selenium

I have to use Selenium to test an application with a live time stamp. My code is: String validationmessage=driver.findElement(By.xpath("//div[@id='part_log_details']/p[1]")).getText(); System.out....
1
vote
1answer
1k views

How to get List of similar elements using javascriptexecutor using selenium webdriver

I want to get list of similar element into arraylist using javascriptexecutor. However able to store only single element using javascriptexecutor. Here is my code: JavascriptExecutor js = (...
2
votes
3answers
2k views

How to run selenium-cucumber eclipse project through command prompt

I need to run selenium-cucumber (Junit) project from command prompt. I tried using the statement in command prompt: java -cp E:\Workspace2\AP\Jars\*;E:\Workspace2\AP\src\stepDefinition\ cucumber.api....
-1
votes
2answers
3k views

How to write XPath under tag: strong<> <br> after every <strong>

I am trying to find xpath of text 262567 of given below HTML code : <div class="lessthanhalf" > <h4> Listing</h4> <strong style="background: rgb(204, 136, 136); border: 2px ...
1
vote
2answers
4k views

Unable to click on dropdown element using for loop [closed]

I wrote a for loop code that can access a dropdown list. I'm able to print the list but the code is unable to click on the specified option public void userCapturesAccountDetails() { WebDriver ...
1
vote
1answer
13k views

How to use a regular expression to identify xpath of element with autogenerating id

I need to access this element: <input id ="combo-1105-inputWrap"> The 4 digits in the xpath are autogenerated per browser session. I need to find that particular xpath and key in the data. ...
0
votes
1answer
2k views

Element not visible even id present for the element

I want to check one element, with help of that element id, prepared selenium web driver script, when will click on that ui element it will open another hided section on same window, but getting error "...
1
vote
1answer
74 views

Selenium scripts will run successfully on different versions of windows OS?

I have some selenium scripts for my project. I have developed and tested on windows 7 OS.But I would like to know whether these same scripts will run successfully on different versions of windows OS ...
1
vote
2answers
808 views

Duplicate records identification in selenium [closed]

I was asked in an interview this question That two different scenario requires data from a common sheet. How to we identify that data already used , while passing it as input. In general how to ...
2
votes
0answers
528 views

How to set browser window size using Phantom JS + Java

I am working on PhantomJS with Java for one of my project. I am looking for some help in working with PhantomJS in following scenario. Scenario : Step-1 : Mouse hover on tab/link then 2 sub-links ...
0
votes
2answers
1k views

Getting an error after execution as FAILED CONFIGURATION: @BeforeTest Login [closed]

java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/...
0
votes
1answer
901 views

How to iterate a list of WebElements and store the values and to perform DB Comparision [closed]

From UI I have to read the below values (I have given example values) EmployeeID : 100 First name : abc Last name : XYZ Joining date : 22-Aug-2015 Gender : Male Phone Number : 10908333 I have ...
4
votes
2answers
826 views

Selenium / Java: how to handle test case execution on a flaky network connection?

What is the best strategy to handle test case execution when there is a possibility of losing network connectivity during execution? In my case, I have to run 300 test cases which usually take around ...
3
votes
2answers
17k views

How to call a method from one class to another class when both are TestNG classes

I have 2 TestNG classes which are: ProductCanvas package objectRepo; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium....
2
votes
0answers
145 views

How do I access fields within Braintree's Hosted Fields' iframes using selenium

On my application payment gateway is Braintree, I need to automate it and face some difficulties when i am automating it, major problem is I cannot send credit cart details using x path, I research ...
1
vote
3answers
10k 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 ...
0
votes
1answer
801 views

Unable to call method in main class

I am trying to call a method in the main function using selenium. However, I am not able to do so. Getting null pointer error. The subclass drinks should be called in the main class coop_main. Could ...
7
votes
2answers
4k views

How to get max character count for input fields with selenium webdriver

How to get the maximum allowed character in any text box eg.user name, email address, in selenium webdriver ?
-2
votes
4answers
702 views

Unable to customize XPath containing span

I want to select all the products having rating 4.5 and add to the cart. However, I am not able to customize the XPath. I tried the below XPath: //div[@class='product-item__rating']/span This ...
2
votes
1answer
6k views

How to locate element inside <form> <table> element </table> </form>?

I want to locate element TableHeader which is inside a form table, it has the following page structure: <form> <table id="topNavigation" cellspacing="0" cellpadding="0" border="0" width="...
4
votes
4answers
6k views

Find first IMG element using XPATH

I am trying to find first fridge IMG element in a e-Commerce page but I could not find it alone, It's identifying all Images under First DIV.. Please share you thoughts I tried below XPATH, is there ...
-1
votes
1answer
462 views

Selecting available Usernames while creating Gmail Account using Selenium

How to select from available usernames while creating Gmail account using Selenium when the username was chosen is already taken? driver.get("https://accounts.google.com/SignUp?service=mail&...