Skip to main content

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
1 answer
386 views

Selenium controlled Chrome and Edge can't both access webcams

I am using Selenium 4 in java to control Chrome and Edge and other browsers in order to test a video call app. I have a test where I'm starting up 2 different browsers at once in order to get them to ...
0 votes
1 answer
28 views

Appium version issue

I am confused to see what Appium version is installed on my machine. If I look into Appium UI it shows Appium v1.22.3 but When I check from cmd it shows 2.0.0-beta.71. how do I know which one is ...
7 votes
5 answers
4k views

How to write unit test for methods with a large number of parameters?

I am asking in case I run into this scenario in the future. Someone in my company wrote multiple methods with 25 parameters. I don't know how/why it got thru code review. I'm just wondering how ...
1 vote
7 answers
11k views

Unable to click button using Selenium Webdriver Java

I am trying to click a button through webdriver. After inspecting the button element it highlights to the following: XPath: /html/body/div/div/main/div/div[2]/div/div[2]/table/tbody/tr/td[4]/form/...
2 votes
2 answers
640 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 ...
5 votes
2 answers
18k views

Why drag and drop is not working in Selenium Webdriver?

I am trying to drag an element into another element using Selenium WebDriver but it's not working. I tried all the solutions which I can find on internet but none of the solutions seems to be working ...
1 vote
1 answer
189 views

Selenium Java best practices for handling different languages and locations, and setting dynamic architecture

Im currently working on a platform that has multi-language options and also the language is defined by IP. So Im trying to build an architecture for testing both scenarios dynamically... The domain is ...
1 vote
2 answers
1k views

On selecting the radio button how to get the text of the selected radio button where the text is in the next column

On selecting the radio button how to get the text of the selected radio button where the text is in the next column I randomly select the radio button and then i need to Store the selected Radio ...
0 votes
1 answer
2k views

Selenium Webdriver fails to load browser through WebDriverManager

We can run our tests in different browsers in selenium Webdriver, previously we need to executable files to run our test in any browser. But now we can achieve without using exe files & with the ...
1 vote
2 answers
184 views

How to Automate the fields that are text and drop downs. You are not sure that how may fields will be and of which type (text/drop down.)

The situation is that admin sets the Specified fields for the front end user and it is upon admin to decide how many fields he'll set for the user. One thing is that he can only create 2 types of ...
0 votes
3 answers
560 views

Can't Select random months dates using jquery calender

I have Jquery calender in my application. I have task to select dates from different months using Selenium, but I can do only previous month and forward month. Actually I need to select dates from ...
1 vote
2 answers
545 views

Parallel selenium UI test failure rate has increase when compared to sequential execution

Recently I have implemented parallel selenium UI test execution by increasing Jenkins node count and creating multiple Jenkins jobs with different regression.xml files pointing to them. In a nutshell ...
0 votes
1 answer
28 views

What is the correct way to wait for database updates when testing the api?

I'm testing the api - after the request, I check that the values have appeared in the database. A simple example is I'm throwing JSON { "field_1": "Value_1", "...
0 votes
3 answers
139 views

Multiple browser support

Currently, our automation suite runs on Chrome (has been designed for Chrome). We used Cucumber with Java and Selenium. We are trying to make the current automation suite multi-browser compatible. The ...
1 vote
3 answers
7k views

Unable to find element with xpath within nested framesets

I'm using driver.findElement(By.xpath("//a[@title='A K T İ V A S Y O N']")); to locate the element given below in the screenshots but getting Unable to find element error. There are nested classes ...
0 votes
1 answer
505 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 vote
1 answer
2k views

How to launch Firefox Geckodriver with add-on enabled in selenium java?

I'm trying to use a custom profile in Firefox with an add-on, I can open the profile, launch URL, I even see the add-on icon on top bar but is always set into the disabled mode, I need to set it to ...
0 votes
1 answer
1k views

Unable to set proxy with BrowserMobProxy while modifying http header request in Selenium with Java

I am able to modify http request header using BrowserMobProxy, the same way explained https://sqa.stackexchange.com/a/37318/9043 But, the problem I am having at the moment is, that I am executing my ...
1 vote
1 answer
4k views

How to send nested JSON in cucumber as request

I'm trying to send nested JSON through Cucumber data table. I have the following scenario, I have tried Scenario Outline too but it didn't resolve the issue. Scenario: provider edits new ...
0 votes
1 answer
928 views

JMeter + Webdriver : Java code is not taking screenshot and it is giving ERROR c.g.j.p.w.s.WebDriverSampler: Sourced file: inline evaluation of:

I am new to JMeter + WebDriver + Java. JavaScript code is working as expected for screenshot. Due to recent upgrade of Java, we are moving from JavaScript to Java. Below is the code. Can you please ...
0 votes
1 answer
4k 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 vote
3 answers
3k views

Selenium - Click on button in the last row of the table

I have the below script where I have taken the list of WebElement of the number of rows and subtracted with and then click on the Add button. But the problem over here is - script clicking on the Add ...
0 votes
1 answer
51 views

Get code from email - java

I have an automation flow where there is a need retrieve a code from an email and input it into as a verification code. As its a demo I could use any temp email and grab it but I am wondering now what ...
0 votes
1 answer
33 views

Best way to automate File contents verification using Selenium/Java?

In my application, there are lot of files that contain financial data and those are sent to different parties. So, I have to automate verification of content of all these files. Now, each file has a ...
1 vote
1 answer
430 views

Get error (Illegal query expression: must be surrounded with curly brackets) while trying to fetch details about test-set in QC ALM Rest api

I want to update the test results of Cucumber test scenarios to QC ALM using Rest API. I have individual test-set for all automation test scenario (There is a 1-1 mapping between automation test ...
1 vote
3 answers
128 views

Why would StringUtils return the incorrect # of matches of a substring?

I'm using StringUtils from the Apache commons library to check the # of matches of a sub-string within the source code of an HTML page. I have converted the page source using the WebDriver command: ...
0 votes
1 answer
2k views

How to handle disable button?

In my script below code when Thread.sleep() is not used, then it throws an exception "element click intercepted: Element <button _ngcontent-yyo-c131="" class="btn btn-sm btn-...
1 vote
1 answer
219 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
1 answer
533 views

How do I select the li element from dropdown using java in selenium

Below are the code which I used: driver.findElement(By.xpath("//div[@class=' flag-dropdown']")).click(); WebDriverWait wait = new WebDriverWait(driver, 10); List<WebElement>...
0 votes
2 answers
247 views

How to run java+selenium method continuously?

There is a functionality like in sometimes one of modal pops up and there is a button on it. If the modal pops up user needs to click on that button. This is a continuous process and I need to ...
0 votes
1 answer
259 views

Unable to execute single tc, login then run other application features, right now its running as a suite

I have to execute my test cases as a single as well as a suite, right now its running as a suite but not as a single test case in selenium webdriver: Below is my test which are calling methods present ...
0 votes
1 answer
699 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
2 answers
1k views

How to scroll horizontally knowing that the required tab has no unique ID (Appium using Java)

What I want to do is scrolling horizontally in a tab that doesn't have a unique ID. I have code how to scroll using id and textmatches like this example: driver.findElement (MobileBy....
1 vote
2 answers
169 views

how to add "\n" to the method

I have the below method: PUBLIC methodname(WebDriver driver,formEntryMap<String,String>,String Colkey) { String Xpath = This will have the xpath of the input text box inputfieldEntry(driver,...
1 vote
3 answers
3k views

[Selenium + Java]: How to handle tooltip on onmouseover?

The test case is to check if the tooltip message shows. My html code is as: <td id="pendingBalance" align="right"> <a onmouseover="displayHelpPopup(this,arrHelp[20][0]...
0 votes
1 answer
80 views

Test data management for automation api testing

Can you help me with some ideas on how to deal more efficent with test data used as precondition for automated api tests? I can’t use api calls for creating the data, so I would have to use sql ...
0 votes
1 answer
756 views

Java selenium - pretty cucumber reports not generated with screenshot

could you tell me how to generate pretty html reports with screenshot ? After I run the test the "cucumber-reports.html" does not exist. Only "image.png" file is generated. ...
1 vote
1 answer
807 views

How to share data between steps in Cucumber feature file?

I am designing automation scripts using the REST APIs, RestAssured with Cucumber BDD framework. I have multiple APIs where one API's response is used as a parameter in another API. Here is my feature ...
3 votes
2 answers
1k views

Cucumber not finding @Findby annotations

Im trying to set up cucumber over my page object. I currently have as my login page object: @FindBy (id = cF.username) public WebElement username; @FindBy (id = cF.password) ...
0 votes
1 answer
227 views

Getting this error when i run my java appium script

When I save and run the code the compiler is showing error with respect to DesiredCapabilities I thought I might have made an error while importing the jar so I uninstalled everything and installed it ...
1 vote
1 answer
2k views

Java Cucumber - pretty html reports net.masterthought - No JSON report file was found

I get the following error when I run the code About to generate Cucumber report. May 02, 2023 6:55:06 PM net.masterthought.cucumber.ReportBuilder generateErrorPage WARNING: Unexpected error net....
0 votes
2 answers
191 views

How to get content of an clickable element in Selenium?

Facing issue to read content after clicking an element in Selenium. I have tried with below code: if(webElement2.isDisplayed()) { webElement.explicitWaitToClickElement(4,webElement); ...
1 vote
2 answers
1k views

Click getting to lower item (under dropdown) instead of dropdown in Selenium

I m trying to click on the dropdown menu item and i am able to select the dropdown and the menu item but instead of clicking on item the click is going to the element right under it. Before the ...
2 votes
2 answers
1k 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 ...
1 vote
2 answers
10k views

How to read numerical cells without converting to scientific notation (reading excel using Apache POI)

I am trying to read an excel file and validate the values. While reading one of the columns which has decimal values, the digits after the decimal point are not correctly retrieved. Suppose, I am ...
0 votes
2 answers
3k views

While reading repository properties file getting error response as: The method click() is undefined for the type Object

Code isn't able to read Properties file. It returns validation error message in response; The method click() is undefined for the type Object Properties obj = new Properties(); FileInputStream ...
1 vote
1 answer
213 views

How to extract adb dumpsys response for validation?

I need to validate few status of the android device. Can any one let me know how to extract the information from adb dumpsys and validate the responses using Java. Your help is much appreciated. Ex: '...
0 votes
1 answer
4k views

How to load chrome profile with Selenium correctly?

So I am trying to write a test in which the first step is logging in, but it is denying me access as it detected automation tools because the javascript has not been enabled and there is no profile. ...
1 vote
4 answers
217 views

Window handling in java selenium

Successfully handled the child window in java selenium but the cursor is not moving forward to the password field. My code is below package perfect; //import java.util.Set; import org.openqa....
0 votes
1 answer
146 views

ScreenShot taken isn't of what's showing in the screen, but rather that of the header until a page size

When I try to take a screenshot, I added a scroll so that it can take a significant screenshot and not only the header. Right now, the picture is still taken from the header/top of the page. Am I ...

1
2 3 4 5
30