Stack Exchange Network

Stack Exchange network consists of 174 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 [java]

Questions about testing applications written in Java or test automation written in Java, a popular programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

0
votes
1answer
22 views

How to move element in svg using selenium?

This is HTML code before having the element in svg. After that, I pull a new element from the sidebar into svg and HTML code like that So I want to move a new element to new position in svg. Example:...
2
votes
1answer
34 views

How to pass the same webdriver instance between Cucumber tests?

I have a series of steps in a Cucumber-automated test for a web-site. In some cases, I need to pass the Selenium webdriver instance, such that the test can use it to wait until certain elements on the ...
0
votes
1answer
38 views

Sleeper in Selenium WebDriverWait constructor - what is it for (Java)?

I have checked Selenium documentation and I can see that there are three different WebDriverWait constructors including this (Java): public WebDriverWait(WebDriver driver, java.time....
0
votes
0answers
20 views

Getting error as Type Mismatch [on hold]

package newpackage; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; //import org.openqa.selenium.firefox.FirefoxDriver; public class MyClass { public static ...
0
votes
1answer
25 views

Create custom annotations for automation framework

I have over 3 years of experience in Java+Selenium WebDriver+Maven framework. I have people using different annotations applied on functions. These annotations were not part of tool's inbuilt feature ...
0
votes
1answer
36 views

Verify checkbox without using isSelected method

I can locate the checkbox using xPath but cannot verify if this checkbox is selected using the isSelected() method. I'm using the xPath as //div[@class='Form-field Form-field--spacer']//label[@for='...
0
votes
0answers
24 views

How to Select and read the results after applying filters in Selenium

I have a question, I have an option for selecting the bank transactions for 2 years and when I apply filters all the transactions for those 2 years are displayed in a summary view. I want to expand ...
0
votes
0answers
32 views

How to automate radio buttons that are not selected by default using selenium java?

In a webpage (HTML below) I have two radio buttons. Neither of them are selected by default. While trying to automate the click event on the button i got this error - "element not find". I did set ...
0
votes
1answer
31 views

How to keep a count on number of clicks on a file

I want to move the file downloaded on first click to folder 1 and move the file downloaded on second click to folder 2 using java. How it can be achieved using Java. Can somebody help me ? for (...
0
votes
1answer
37 views

Move files from one folder to another based on extension

I have written a program wherein I log into a website and download few csv files (wherein the file names are randomly generated). Now I want to move the csv files from download folder to one specific ...
0
votes
1answer
30 views

Why Cucumber repeats Java/Selenium exception text?

For example, tried to locale a web page element by ID and it was not there - why Cucumber repeats the Java output (in addition to - expected - its own scenario/feature/steps failure text) and can I ...
0
votes
1answer
49 views

How to Select a value from Dropdown using Selenium WebDriver (Java) having input and div but not select tag?

I am trying to select a value from a dropdown. When I inspect that dropdown, I cannot see the select Tag, instead it was designed with combination of input and div tags. Can anyone suggest a way how ...
0
votes
1answer
22 views

NullPointerException in RequestSpecification

Getting Null pointer exception whenever running, unable to resolve. Below is my code public static RequestSpecification setFormParam(String formParam, RequestSpecification reqSpec) { ...
1
vote
3answers
59 views

How to download the csv file using Selenium

I need to download the CSV files from this page but i am not able to do so. PFA the screenshot of the page from where the files has to be downloaded : I have tried the below code but it doesn't work ...
0
votes
1answer
42 views

How to embed Jquery script in Java Selenium code

I am automating a process a process where I need to download csv files from a website. I have written a jquery code for that. Can someone tell me how can i integrate this code with my Java selenium ...
-2
votes
1answer
36 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....
-1
votes
1answer
43 views

Getting error message while running selenium script

I am facing this problem, please give me a solution [RemoteTestNG] detected TestNG version 6.14.2 Starting ChromeDriver 2.42.591088 (7b2b2dca23cca0862f674758c9a3933e685c27d5) on port 7027 Only local ...
1
vote
0answers
27 views

Unable to call custom annotation in selenium test

Unable to call custom annotation in selenium test i am writing a Apache poi selenium junit test - To avoid @RunWith i have tried myown annotation public class MyTest extends OtherTest { String a ;...
0
votes
1answer
41 views

Page Object Model: need help with tests that uses more than 1 page object - Appium-Java-TestNG

I have a framework based on POM model. I am able to write test that only uses elements from 1 page but when I need to access elements from another page tests fail because I think it uses the wrong ...
0
votes
5answers
148 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 ...
0
votes
1answer
36 views

How can I verify text exist within a table with db using Selenium WebDriver?

Using selenium Webdriver+Java- I am looking for a way to identify and or verify a value in a table. There are more columns in the table, but I am only concerned with the Country column, Also the ...
0
votes
1answer
37 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....
0
votes
2answers
65 views

How do I loop multiple user action in Selenium Webdriver?

Currently I have issue, when a content get a multiple like from different user, the content will be unable to access due to error (let's say get a likes from 100 different user) I just manually edit ...
0
votes
1answer
67 views

Selenium driver.getWindowHandles() is not working while opening new tabs in same browser window

package demo.webtables; import java.util.HashSet; import java.util.Set; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa....
0
votes
2answers
93 views

Unable to enter in dynamic textfield

Trying to enter pin number in dynamic textfield. Pin number option get change each time once website loaded. <input type="password" maxlength="1" class="input-pin input-validation-error" ...
0
votes
1answer
28 views

Can't able to run TestNG its show an error below I mentioned

[RemoteTestNG] detected TestNG version 6.14.2 org.testng.TestNGException: Cannot instantiate class testing.test at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30) ...
0
votes
2answers
54 views

How do I use sendKeys to input multiple random value in different rows?

I have a text field to input voucher code, and I already tried this; driver.findElement(By.id("voucher_code")).sendKeys("AL982", "OK992", "PO982", "SX982", "LQ925"); In the text field it become like ...
0
votes
1answer
37 views

Simplifying Setup of TestNG/Selenium WebDriver Test Classes (using Google Guice?)

I am developing test cases using Selenium and TestNG, and am following the Page Object Model design pattern. Currently, my page classes look like this (Page1 is just a placeholder, they all have ...
1
vote
1answer
39 views

Caused by: org.openqa.selenium.NoSuchWindowException: no such window is displayed in Geb

I have a written a Geb script for automation and I need to handle the Popup. but when switching the child window to parent window am getting a No Such Window Exception Below is my code: def ...
0
votes
1answer
31 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 ...
1
vote
1answer
56 views

How to improve slowness of my automation code?

I am doing automation. But my code working takes more time. I am taking index value from deDupStringList array. for click on the gui application. I read the data from back end. This is my entire ...
1
vote
1answer
58 views

How can I type the Fn key in Selenium WebDriver?

I am testing a webapp that uses the key command of Fn + Command + M for macOS computers. How do I send the Fn key in Selenium WebDriver? My first instinct was something like: webElement.sendKeys(...
0
votes
1answer
32 views

How to insert a new data into the list?

I am doing automaton. i'm read the data from database and select the specific data. here my database contains a sequence number list. initially i put it into a array list. this is db sequence number ::...
0
votes
1answer
39 views

I need to verify a dynamic table record, if they match with data then PASS else Fail the test case using Assert

Page Object Class public class Transactions { WebDriver driver; boolean result1; public Transactions(WebDriver driver) { //super(); this.driver = driver; } public void ...
0
votes
1answer
30 views

calculate the total of liabilities and check it is matching with the given value

I want to calculate the total liabilities amount from webtable and need to compare with the total amount which is present on webpage. I got the following error : Illegal/unsupported escape sequence ...
1
vote
1answer
48 views

Which Page Class (POM) to verify successful actions from?

I am working with Selenium WebDriver + Java and following the POM design pattern to create automated tests, one of which involves verifying successful logout of a user account from a webapp. Does it ...
0
votes
2answers
49 views

POM Model -Fetching mobile number from excel sheet like 9.5512395512E9

Working on Page Object Model by using Data driven Framework, fetching data from Excel sheet.When executing the test script the mobile number displays like 9.5512395512E9. In excel sheet Original ...
0
votes
2answers
54 views

How can I keep the variable alive across the project globally?

I have a BaseClass.java which extends PageObject.java class i.e. net.serenitybdd.core.pages.PageObject; Then I have two Page classes LoginPage.java and ProfilePage.java, these two also extending the ...
0
votes
2answers
59 views

How to pass the web driver instance from one testcase class to another testcase class in TestNG?

InitializeDriver.java: public class InitializeDriver{ WebDriver driver; public WebDriver getDriver() throws Exception{ driver = new FirefoxDriver(); System.out.println("Initialize ...
0
votes
2answers
126 views

Element should have been “select” but was “div” error

HTML code of the desired element: <select class="fcr-height-parent oj-select-select oj-component-initnode oj-select-options-generated" data-bind="attr:{id: idTag, name: idTag}, id="...
1
vote
2answers
116 views

Robustness of Page Object Model in Selenium?

I am using Selenium WebDriver with Java to develop automated regression tests for a web application. Currently, I am following the Page Object Model design pattern and using the PageFactory @FindBy ...
0
votes
1answer
28 views

I am Trying To get Two return Types

public static String CalculateNoofDays(String txtDateValue ) throws Exception { String Days=""; String Count=""; String ar[] = new String[2]; ar[0]= Days; ...
1
vote
1answer
81 views

Multithreading: chromedriver does not open url in second window

Java code in thread function, System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver"); ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.addArguments("--no-sandbox"); ...
-2
votes
1answer
49 views

Select a random category from the Homepage

I want to select a random category from the available categories and to select a random sub-category in selenium(java). Please suggest a method to do this. PFB the screenshot for the homepage.
0
votes
1answer
28 views

Read Data from the Excel file

I have 2 columns in the excel file(Attribute & Value). I have the following rows for the login page(email1-value,password1-value,e-mail2-value and password2-value). I need to store all e-mail in ...
0
votes
1answer
35 views

How to find the immediate nearest value in java

I am doing insert after operation automation, according to my case, whenever insert after the case came.. I want to get the nearest minimum value and select that value... here i am fetching from my ...
0
votes
1answer
43 views

Can we Verify Contents on the browser PDF print in Selenium Webdriver?

I need to verify PDF contents, when I click on pdf print button on web page, it displays PDF to print. How can I verify? Is it possible?
0
votes
3answers
40 views

How to handle response varying from developer tool to code debugging in chrome?

I'm using RESTassured with Java. Getting response in compressed from UTF16 format. Response varies from developer tool to code debugging in Chrome/Firefox, here variation means some character got ...
0
votes
0answers
39 views

Cucumber report always generate the same html output

I am using net.masterthought Cucumber reporting in my project. Regardless of how many tests I add, my report always stay the same. I believe this is because of the json file not changing. Below is the ...
1
vote
1answer
51 views

How to iterate i value in page object model

I need a solution how to iterate value of i. Actually my test case contain one webtable and table have five column also fifth column contain four buttons. So depending on the first column value(for ex ...