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
0 answers
12 views

Facing challenges to run java selenium tests with gitlab runner

I am trying to run cucumber maven tests on gitlab ci using selenium grid, from the output I have observed that containers for grid setup are up and running. But I am not able to run my cucumber tests ...
  • 287
0 votes
0 answers
14 views

Not able to run selenoid tests with gitlab using dind for java maven tech stack

I am relatively new to gitlab and selenoid. I have been trying to run my tests on selenoid with gitlab and below is what my gitlab-ci.yml file looks like: image: maven:3.8-openjdk-11 variables: ...
  • 287
0 votes
1 answer
20 views

org.openqa.selenium.interactions.MoveTargetOutOfBoundsException: move target out of bounds

I am passing input to rich text field. For that I have written the code below: public void inputToDescriptionField() throws InterruptedException , AWTException { wait.until(...
-1 votes
1 answer
19 views

For Android testing (using Java), is it better to have Accessibility IDs put in, or will Element IDs or just "id" suffice?

An Android app to be automated tested has no Accessibility IDs (aka element's content-desc attribute) whatsoever. I'm hearing that it would be good for the developers to put this in, but I've also ...
1 vote
1 answer
44 views

Differences between Resource ID, TestID, Element ID, ID, and Accessibility ID?

This info is so scattered across some of my searching. However, I'd like to get the community's knowledge on this. Especially for the purposes of locating elements in code (Appium, testing Android app,...
0 votes
1 answer
37 views

how to automate a date picker that not in a table tag

I want to automate that starting date and end date but in DOM I can't find a Table tag for date picker so I don't know how to locate the field. The tag is <input class="inputvd" type=&...
-1 votes
1 answer
37 views

How to validate invalid date error message in Selenium Java project?

I have a "Date" field on my page I want to automate. Now, when I enter invalid value or invalid format, then its displays an error like: "This is invalid value for "Date" ...
0 votes
0 answers
59 views

Cucumber TestNG Gradle Parallel Execution ThreadCount

I am trying to run my Cucumber scenarios in parallel using the TestNG. But when I run it 'parallel=true' it executes the test cases in thread count=10 (testng default). I want to customise the thread ...
  • 760
0 votes
0 answers
9 views

How to terminate the application and make the launcher return to its call by the stop command?

In question: Need code examples on how to use org.junit.platform.launcher.listeners problems have been resolved: Exit – program interruption Pause (true) – stops work before receiving Pause (false) ...
  • 13
0 votes
1 answer
51 views

Need code examples on how to use org.junit.platform.launcher.listeners

I run according to the documentation with a test class with 30 tests inside org.junit.platform.launcher.Launcher I have a function launcher.registerTestExecutionListeners(listener) registered in org....
  • 13
2 votes
3 answers
55 views

How to validate if .txt file format is correct as a part of File processing in Automation framework?

In my Selenium+Java automation framework, I need to open a .txt file or any other extension file and then see if the text is in a particular format. Now, I need to see if all lines are in this format ...
0 votes
3 answers
30 views

java.lang.NullPointerException - at com.qa.factory.factory.DriverFactory.init_driver(DriverFactory.java:26)

public class DriverFactory { public WebDriver driver; public static ThreadLocal<WebDriver> tlDriver = new ThreadLocal<>(); /** * This method is used to initialize the threadlocal driver ...
0 votes
2 answers
163 views

How to load Config.properties file in Cucumber TestRunner.java file?

To run my Selenium/Cucumber java project, I need to pass some VM arguments, variables, properties path etc... now easiest way is to pass it in Eclipse run configuration under "VM arguments" ...
-1 votes
2 answers
56 views

Is it mandatory to return a PageObject instance in every Page Object save/submit method?

In the Page Object model, we separate page UI elements and Test methods. However, there is a concept of Page chaining, in which we return an object on the next Page Object in the previous page object ...
0 votes
4 answers
87 views

Selenium email automation

I'm trying to automate tests using Selenium and a Yahoo email address. The problem is when I run my test in Azure DevOps I face the CAPTCHA privacy terms. Any ideas on how to fix this problem?
-1 votes
1 answer
31 views

Javawith selenium

[RemoteTestNG] detected TestNG version 6.14.3 [TestNGContentHandler] [WARN] It is strongly recommended to add "<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >" at ...
-1 votes
1 answer
36 views

Verify that 4 products are shown with € symbol

I want to verify from this website: https://demo.nopcommerce.com/. There are 4 products shown with the Euro symbol by using for loop. Code: List <WebElement> productcurrency = driver....
1 vote
1 answer
50 views

How to Switch frame in Selenium java

I'm trying to switch frame to email body, but it's not working. I'm not able to switch frames. Expectation: I need to open yopmail and get a text from second email. Email - Secondemail1234@yopmail.com ...
  • 11
-1 votes
2 answers
61 views

How would you prioritize these bugs, and why? [closed]

Here is a hypothetical scenario for a software quality assurance (QA) logical question: You are a QA engineer testing a new feature for a web application. The feature allows users to upload and share ...
1 vote
4 answers
108 views

Selenium Test cases for UI look

I have a test case, where I need to verify: a user selects any of the options. the text is not going out of the layout and displays complete readability to the user. As a result, the UI look and ...
0 votes
1 answer
46 views

ExtentReports doesn't save the screenshot with the report

Hello I am trying to capture screenshot of failed test cases using selenium webdriver with Maven and TestNG with following code, it does generate the screenshot in my project but doesn't get included ...
  • 21
0 votes
3 answers
219 views

perform button click if specific element is present

I have a product list and some products have discount available. I want to click buy if discount price text is available. Below is a product with discount <article class="commerce-product--...
0 votes
1 answer
401 views

Test has been compiled by a more recent version of the Java Runtime (org/testng/annotations/TestNG)

I found my issue below when using this dependencies: </dependency> <dependency> <groupId>io.appium</groupId> <artifactId>java-...
0 votes
4 answers
243 views

Verify element is visible using selenium and java

I am trying to identify a specific element and perform some actions. This specific element is not available in every element I am looping. Below is the element I'm trying to catch. <span class=&...
0 votes
1 answer
163 views

Verify search results using boolean value in if else

I have to automate the functionality of search.There are 2 possible out comes. one is result is generated the other is results not found. if there are matching results to search criteria a new div ...
0 votes
1 answer
700 views

I'm stuck with the following "error java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "browserName" is null"

I can't identify any issue with the code, can someone help me package com.ai.qa.base; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java....
0 votes
0 answers
12 views

how to locate element on a new window that pops up from a primary window [duplicate]

I am running a test on a story for payment, and when it gets to the page, a third party (Klarna), I was unable to locate the element from the new web page from the third party. Could it be because the ...
0 votes
0 answers
274 views

Cucumber .Hoook class is throwing errors due to not having an empty constructor

I've been struggling with this issue all the day and no way for solving it. The thing is that if I put a non-empty constructor (with the context) for the .Hooks class, there is an exception of the ...
1 vote
1 answer
2k views

Log4J2 is not printing message from Log.info()

While writing the below code, no message is being printed on the console for logger.debug(), and logger.info() methods. package log4j2.test; import org.apache.logging.log4j.Logger; import org.apache....
0 votes
1 answer
168 views

how to validate empty screenshot in selenium webdriver

Is there any possibility to check empty or blank screen shots. Sometimes, the screen shot is blank when am using TakesScreenshot ss = (TakesScreenshot)driver;
  • 1
0 votes
0 answers
58 views

unable to locate and Element after else condition

i have provided the condition when in if it works fine and after accepting the condition it is coming out of the loop and finding elements.but after executing else condition it is not finding the ...
  • 1
0 votes
0 answers
18 views

How to reduce execution speed by using gitlab runner

I have a GitLab repo with selenium 4 TestNG tests. They run on 4x8gb runner. It has a pipline that compiles runs sanity check, downloads drivers and then push it, for next 3 parallel jobs to download ...
7 votes
1 answer
349 views

Selenium + Java: How to get the OS, and Browser details on run time?

What I want to do is, while I'm running my tests, I want to get the current, Operating System Browser Name Browser Version This is for making the details clear in the test/bug report. I haven't ...
0 votes
2 answers
226 views

How to end the if condition if ,if condition keep failing all the time

I have the below method in my code to check if a text was updated on the web page. As for the code, I will keep refreshing the web page until the text changes to "Hot" and call the same ...
  • 2,099
2 votes
2 answers
278 views

Not able to match ChromeDriver version with chrome version

So at my current job I’m at a pinch, we can’t just download executable jars and use them. We have to request to download whatever we want . So the problem is , our chrome gets auto updated where as we ...
  • 21
-2 votes
2 answers
1k views

Getting javascript error: element is not defined

I am trying to verify carousel has auto flash and manual selection options. For manual option I checked the slick dots are clickable. For auto flash option I am checking the style animate-repeate is ...
0 votes
0 answers
200 views

find the list of hidden elements using selenium with java

I am trying to fetch all elements using findelements method. However, it is getting only visible elements rather than all hidden elements. Could anyone please suggest how to get the list of all hidden ...
0 votes
3 answers
205 views

getText() method is returning all small letters in selenium instead of actual case

When I tried to get text of particular element which is returning all small letters. Hence my assertion has failed. kindly help me to get actual innertext and please let me know is there any other ...
0 votes
2 answers
5k views

Loop through list of elements and perform a button click

I'm trying to loop through a list of products and identify a product with discount/promotion. if product with discount is available I want to go inside that product clicking buy now and exist for loop....
0 votes
3 answers
671 views

Stale Element Exception when looping through list of elements

I am trying to loop through a list of products, identify products with discount and click on the first product with discount and and navigate to product page. While looping through for loop I get ...
0 votes
0 answers
63 views

Why does my WebDriver object become null in next scenario?

The single feature file contains 2 Scenarios. Scenario: Go to Given Open Firefox When Go to "https://somewebsite.com/" Scenario: Find profile icon Given Find user profile icon ...
3 votes
1 answer
433 views

How to extract a token from form html using regex

I would like to know how I use the regex in Jmeter to capture tokens from HTML. I have created a regex but it's not getting what I required. My HTML code with the token is : <html><head>&...
0 votes
0 answers
54 views

Mobiscroll : Selected value scrolled along when clicked up or down instead of remaning static

With reference to the following screenshot, I am trying to automate clicking of the down button by using the following code : driver.findElement(By.xpath("//div[@class = 'search-start-time']//*[@...
2 votes
1 answer
140 views

Scrollbar value returns false even though it is present

I have a pop up which enables a scroll bar depending on the element count it contains. Right now there are more than two elements and scroll bar is present. Below is my html view of the pop up. <...
0 votes
1 answer
384 views

Is there any way to trigger before Method only for specific test methods

I need to prepare some data before running some test methods in my test class. But these data will be used only in 5 test methods only. The entire test class has 25 test cases. So is there any way to ...
  • 2,099
2 votes
1 answer
79 views

Selenium Webdriver : Trying to get text, but specific class present

Kindly find attached the html code of the section in question I use the following code and managed to get the text for Status successMessage = driver.findElement(By.xpath("//span[@class='status-...
0 votes
1 answer
3k views

Cannot invoke "org.openqa.selenium.SearchContext.findElement(org.openqa.selenium.By)" because "this.searchContext" is null error

I am trying to verify a functionality as a guest user and logged in user. In order to do that I log out form the system and verify the guest user actions then login again and verify logged in user ...
0 votes
1 answer
89 views

Element is not clicked even after explicit wait

I am trying to verify default selected value of a dropdown. <div class="p-3 p-md-4 mt-4 mt-md-4 card"><div class="row"><div class="d-flex align-items-center col-...
2 votes
1 answer
116 views

Verifying scrollbar is present script fails

I'm trying to check whether a scrollbar is present when there are more than 2 elements in a pop up. Here is the HTML code for the div which enables the scroll bar if when there are more than 2 ...
0 votes
1 answer
232 views

Get Time taken to change between two elements

I'm trying to get the scroll time of a carousel. I tried to take time when 1st element is selected and time when 2nd element is selected, then deduct 2nd time from 1st time and get the duration. Below ...

1
2 3 4 5
29