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.

Filter by
Sorted by
Tagged with
0
votes
2answers
44 views

Avoid default selection when selecting random value from dropdown

I have a method below that selects a random item from a dropdown list. This works well mostly, but on occasion it will reselect the default option which is usually "Please Select" or a blank value. ...
1
vote
1answer
43 views

Verifing pdf using Selenium + Java

How can one verify pdf using Selenium + Java? Until recently, I was verifying pdf using Firefox (making sure that the pdf file wasn't empty). This was nice and working fine, but it's not multi-...
0
votes
2answers
31 views

How to rerun failed test from where they instead of from beginning? (TestNG)

Is there any way to re run the failed testcase from the page where it got failed instead of running the testcase from beginning in Selenium Java ?
0
votes
0answers
47 views

Why doesn't 'this.driver = driver', do the same as 'PageFactory.initElements(driver,this)'?

I have a page object with im trying to instantiate so that I can perform methods on it in my tests like goto etc. But when I try to use it with PageFactory.initElements(driver,this);. The browser ...
4
votes
1answer
185 views

Selenium PageFactory vs Page Object Model

I've created a framework in C# using the Page Object Model for fun and am now creating a framework in Java to learn Jenkins etc... also for fun. I have come across the PageFactory concept for Java ...
0
votes
2answers
74 views

Selenium Webdriver sendKeys method sending value twice

I have 6 selenium tests (TestNG) running on chrome and firefox (both up to date versions) which connect to Browser stack to run. the problem is that 1 of the test fails intermittently on Chrome as ...
1
vote
3answers
104 views

One Selenium framework to rule them all (or an actively maintained collection of frameworks)

I am looking for most universal, up to date, open source, selenium framework for test automation. Or at least a number of frameworks for different languages. I am surprised as how every company and ...
0
votes
7answers
90 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
0answers
14 views

Looking for a java library automate third party Java-Swing application without access to the source code

I'm looking to automate a third party java swing application that my company uses. I don't have access to it's source code so a lot of the swing testing libraries like Assert-J won't work. I'd like to ...
0
votes
2answers
49 views

Chromedriver quit() method doesn't close all chrome.exe processes

When I am trying to close the chrome browser using driver.quit() and driver.close(), browser is getting closed but chromedriver.exe process is not getting closed. How can we remove these processes ...
0
votes
0answers
23 views

Java/JNA desktop Application Testing

I am a web developer, so I know what kind of tests need to run on web application before sending it to production. First time I have developed a service for desktop application. That newly developed ...
0
votes
1answer
34 views

What is the best way to create complex json in java?

I want to create a request body to test an API. The request body is a complex JSON as below: { "certificate_registry": { "images": [ { "url": "https://path.jpg" } ], ...
0
votes
3answers
54 views

Mouse hover action to browser window close button

I have a test scenario where the web application checks for the user's leave intent i.e., mouse hovering from the page to the browser close and then a frame gets triggered. Is there any way to do it? ...
2
votes
2answers
652 views

How to verify data is saved or not using selenium?

I am using selenium and java for automation. I am adding new data. after a click on save, data will appear on the left side on the top list and I want to verify. I want to get the first text "new aam ...
0
votes
1answer
52 views

Selenium starts firefox but only stays on a blank page

I've been looking at the distinction between webDriver.naviagate.to and webDriver.get and they seem the same. Certainly a web page launches..but then a big nothing burger. Not sure where to start ...
1
vote
1answer
14 views

In gradle 4.6, how to force all tests in a class gets executed first before moving to tests in next class?

I am using Gradle 4.6 with testng. My test suite has tests organized something like these. java class1 { test 1.1 test 1.2 test 1.3 test 1.4 } java class2 java class3 java class4 java class5 All ...
0
votes
1answer
54 views

Selenium for Internet explorer on Jenkins

Recently, my tests started failing. I'm testing on IE11(company policy) on a jenkins windows slave. My tests all hang on the "This is the initial start page" if I'm not connected to the server. If I ...
0
votes
0answers
21 views

Why Junit parser failed when running Jmeter scripts with Bamboo?

* Please note that this is working fine in my local machine jmeter, only issue happening when running with bamboo * Bamboo Script configuration sh /apps/jmeter/apache-jmeter-5.1/bin/jmeter \ -...
2
votes
1answer
71 views

What method should i use to display the country selected from dropdown on console in Selenium Webdriver?

http://demo.guru99.com/test/newtours/register.php For the above site, I am writing a Selenium code to select a country from the drop-down and want to display selected country on the console in ...
1
vote
2answers
121 views

Stale element reference: element is not attached to the page of the document

I would really appreciate if someone could help figure out what the hell is going on with one of my tests. I'm getting Stale element reference: element is not attached to the page of the ...
0
votes
2answers
64 views

How can I test when app requires OTP via SMS?

I am using Selenium with Java to test a web application. The app requires a user to receive a One-Time Passcode (OTP) to authenticate they are who they say they are and to authorize several critical ...
0
votes
3answers
34 views

Save variable from java test class 1 and use variable in java test class 2

I have written the Selenium scripts (page object model) to navigate a website, fill in form data, and submit the form. I next need to verify that the form data was indeed saved in the database. My ...
0
votes
2answers
39 views

How to Handle Dynamic Changing IDs inside a span

How to Handle Dynamic Changing IDs inside a span In XPath? for example : <span id="listv2_f40a0e90dbcc089cae10d48a489619ee_total_rows" style="margin-left: 1px;">2000</span> In this ...
0
votes
2answers
128 views

Unable to navigate to the URL in Microsoft Edge

I am trying to launch Microsoft Edge browser and navigate to google.com but as soon as the browser launches the execution stops and the browser closes. I am getting the below error in the console. ...
1
vote
2answers
67 views

How do I select a random checkbox on the web page?

I have 3 checkboxes on the webpage. Each time, I want to select checkboxes randomly.
0
votes
2answers
51 views

How do I find total number of links on a web page using selenium and java 11?

package exsc; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.By; public class S1 { public static void main(String[] args) { ...
0
votes
1answer
44 views

Selenium: Capture DOM Elements Image

I have an API to capture the image of a particular element in DOM and return them. For that, I have a list of WebElements which needs to be captured into a single webpage. For that same, I have found ...
0
votes
0answers
26 views

Driver does not recognize pop-up's - can not switch

In years it is the first time I saw something like this, when I do a: config.getWebDriver().getWindowHandles().size() The result is always 1, but in fact, there is a main window opened and after a ...
-1
votes
2answers
36 views

Can anyone explain use of Driver Factory and its implementation to get parallel browser at same time?

When do we need to create a Driver Factory ? What advantages do we get over regular initialisation of driver when we use driver factory approach. Also how to initiate parallel browser testing using ...
0
votes
0answers
12 views

PackageRelationshipCollection issue in selenium

Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.poi.util.POILogger.log(ILjava/lang/Object;)V from class org.apache.poi.openxml4j.opc....
-1
votes
1answer
50 views

Extent reports issue in maven project

I am using extent reports in my project but it is showing me error and I am not getting solution for this error: [RemoteTestNG] detected TestNG version 6.14.3 Starting ChromeDriver 75.0.3770.140 (...
-1
votes
3answers
73 views

Selenium exception: element not intractable

WebDriverWait wait = new WebDriverWait(driver, 30); WebElement button = wait.until(ExpectedConditions.elementToBeClickable(driver.findElement(By.xpath("(//div[contains(@class,'...
-1
votes
1answer
31 views

Can I use this library for Junit?

I put this library: import org.apache.commons.io.FileUtils; but it sends an error The import org.apache.commons.io cannot be resolved what library is equivalent exist for Junit?
1
vote
1answer
23 views

Regarding reading Jmeter output in Java

I have executed jmeter script through java, however I am not able to get output in java. Could you please help me in that. Regards Pankaj
-2
votes
2answers
49 views

How to make a test fail if driver takes long time to look for an element. I am not sure which elements will throw this exception

I am not sure which elements will throw this exception.In general is there any method other than providing - a page load time out , implicit, explicit or frequent wait for a particular element .
0
votes
1answer
39 views

How to add and remove line from notepad file using selenium

Need code to add and remove lines from notepad file using selenium in java. I have to do some more operations on notepad but add and remove will be helpful.
0
votes
1answer
38 views

How to specify target in the TakesScreenshot interface's getScreenshotAs method

On reading the Java documentation of TakesScreenshot interface, it was observed that the method syntax and description for getScreenshotAs are: getScreenshotAs(OutputType<X> target) ...
-1
votes
1answer
42 views

How to validate test logic for date dropdown?

I have a close date field where the date is already populated, and a date creation field which is the actual activity creation date and the logic I want to validate is below - Validate that the ...
0
votes
1answer
32 views

Using priority in test cases with retry listener

I have test cases which have priority tags on them. Let's say 30 cases run sequentially one by one. But this does not allow me to attach a retry listener to my cases due to tests being dependent on ...
0
votes
2answers
29 views

I have defined one variable Total_users=100 in test plan and want to define thread group in defined percantages of total users

I have defined variable Total_users=100 in test plan and i have four thread group. ThreadGroup1:- Dashboard(50% of total users), ThreadGroup2:- Order(10% of total users), ThreadGroup3:- Shipments(...
-1
votes
1answer
86 views

Deprecation issue for InternetExplorerDriver

I want to use PAGE_LOAD_STRATEGY strategy while launching IE driver by using the following code but I'm facing a deprecation issue for InternetExplorerDriver. What's the reason for it? ...
0
votes
1answer
31 views

Is it possible to make a jar file using Selenium java and Eclipse and run that file on any machine for the testing

I am using Selenium and Java with Eclipse and TestNG. Now I want to make a .jar file for running this test case on another system that doesn't have Selenium and Java. How can this be done?
1
vote
5answers
171 views

Why can't we write “ChromeDriver driver = new ChromeDriver();” in Selenium?

Why do we create a ChromeDriver instance and then assign it to a "WebDriver" interace reference. Webdriver driver = new ChromeDriver(); Why cant we create a Chromedriver , Firefoxdriver or IEDriver ...
1
vote
1answer
146 views

Disable physical mouse and keyboard in selenium

I am trying to run an automated test that requires me to move the mouse around the page. The problem is that whenever the person running the test moves the physical mouse while the test is running, ...
0
votes
2answers
30 views

Java Selenium: Custom Assert Message for Multiple Checkbox

I'm working with an automated script for multiple checkboxes that has dependent permissions. Given there are multiple checkboxes Checkbox A Checkbox B Checkbox C Checkbox D Checkbox E When I ...
0
votes
4answers
60 views

How to validate that user is not able to enter any data in the given field using selenium java

I want to validate that field is not editable. Code I am trying is: driver.findElement(By.xpath("//div[@comp-id='1494']")).click(); driver.findElement(By.xpath("//div[@comp-id='1494']")).sendKeys("...
0
votes
3answers
118 views

How to get value of WebElement init in PageFactory?

For example: @FindBy(xpath = "//div[@id='panel']//span[@class='name']") private WebElement panel; I've got a panel element. Is it possible to get value of XPath that I init above? I need a solution ...
-1
votes
1answer
41 views

Unit Testing and Integration Testing with Robot and Cucumber

I understand that both frameworks are great for acceptance testing but how hard or more complex is writing lower level tests such as integration tests or unit tests using the mentioned frameworks when ...
0
votes
1answer
84 views

Cannot Instantiate Class error Selenium Testng Maven

package com.qa.easy.testbase; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Properties; import org.openqa....
0
votes
1answer
27 views

Is it possible to use methods in java library or a java project snapshot in a protractor project? [closed]

If I create database testing project using java and export to a snapshot(as a jar), can I use it in a protractor project? Hoping to use in protractor project, protractor,jasmine framework along ...