r/SeleniumJava • • Oct 15 '24

Send keys without specifying element in java Selenium webdriver

1 Upvotes

Selenium WebDriver involves interacting with web elements such as sending input to text fields which requires identifying the target element explicitly using locators like id, name, or CSS selectors.

However, there may be scenarios where you want to simulate keyboard input without directly specifying the element.

For Example: I want to send some text to the input box of this demo site without locating the input element by tag name or whatever.

https://the-internet.herokuapp.com/inputs

Q: How many ways can I achieve that scenario?


r/SeleniumJava • • Aug 17 '24

NoSuchElement exception issue

1 Upvotes

I am getting a NoSuchElement exception for pretty much all of the elements I try to interact with on the following page.

The page does have frames, however the path I need to use isn't inside them so not sure if this is the issue or not

Would appreciate any help on this as it has me completely stuck. Note when opening it incognito mode there is a privacy pop up that comes up so not sure if this is causing the issue, I am trying to hit the accept all button.

Webpage - https://www.landrover.co.uk/offers-and-finance/finance-calculator.html

Xpath- //body[@class='page basicpage']//div[@id='onetrust-consent-sdk']//div[@class='ot-sdk-container']//button[contains(text(), 'ACCEPT ALL')]


r/SeleniumJava • • Aug 12 '24

Throwing Nosuchelement exception. Even though the try and catch are written. Tried GPT too, not working

Post image
1 Upvotes

r/SeleniumJava • • Aug 07 '24

Better Institute In Hyderabad to learn the selenium with java

1 Upvotes

I Need to Learn the selenium with java , I am searching for the Better Institute to learn , Can u people please help on this. Thank You!


r/SeleniumJava • • Jul 28 '24

JBehave Web Selenium version?

Thumbnail self.softwaretesting
1 Upvotes

r/SeleniumJava • • Jul 21 '24

Custom Annotation in Java

1 Upvotes

Hi guys, i need to know that anyone has tried to write a custom annotation that works like Lombok's Setter/Getter annotation

My use case is in my project i have quite few methods like selenium's click/sendkeys, i need to make a custom annotation to just annotate on my locator to generate a POM class to look simple and easy to read.


r/SeleniumJava • • Jul 09 '24

AWS for executing automated tests with selenium + java doesn't fill fileds with sendKeys command

1 Upvotes

0

I'm using AWS to execute automated regression tests with Selenium and Java. I've encountered an issue where, on some forms, the fields are not being populated with text after the sendKeys() command. This issue does not occur when I run the tests on my local machine. Has anyone experienced this before, and how did you solve it?

I also try to to complete fields with JS executor:

JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].value='4646464646464644';", adyenCardNumber);

This populates the fields, but the form is not validated after clicking submit button.


r/SeleniumJava • • Jan 24 '24

I have this problem with Selenium and Java

1 Upvotes

Hi

I tried to use Selenium with Java in Eclipse and this happened...I am new in this and dont know what is wrong exactly here. Can someone help me?


r/SeleniumJava • • Jan 24 '24

Having an issue running selenium application inside docker

1 Upvotes

To run the Java Selenium application on a separate server I am attempting to build a Dockerfile install Chrome and use a headless way to run a browser. (This application provides a desired output when executed locally.) But when attempting to run the docker I receive this error.

Am I missing something in the docker build or the Java-based configurations provided.? How should chrome driver-related configurations be added?Technologies used

  • OS - Ubuntu 22.04 LTS

  • Docker version - Docker version 24.0.2, build cb74dfc

  • Java version - java version "17.0.4" 2022-07-19 LTS

  • Selenium version - 4.11.0

  • Chrome version - Google Chrome 120.0.6099.199

Update: There also seems to be another way to run Chrome using selenium/standalone-chrome. Is it possible to integrate chrome/selenium with another docker using this method? which is the preferred option of these two methods?

FAILED CONFIGURATION: u/BeforeClass openBrowser

org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*, --headless], extensions: [], prefs: {download.default_directory: report/}}}, error Command failed with code: 65, executed: [/tmp/selenium-manager246697546082813077936780283589629/selenium-manager, --browser, chrome, --output, json]

request or response body error: operation timed out

Build info: version: '4.11.0', revision: '040bc5406b'

System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-150-generic', java.version: '17.0.6'

Driver info: driver.version: ChromeDriver

at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:25)

at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:13)

at org.openqa.selenium.chrome.ChromeDriver.generateExecutor(ChromeDriver.java:99)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:88)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:83)

at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:72)

at Infra.BasePage.openBrowser(BasePage.java:108

Caused by: org.openqa.selenium.WebDriverException: Command failed with code: 65, executed: [/tmp/selenium-manager246697546082813077936780283589629/selenium-manager, --browser, chrome, --output, json]

request or response body error: operation timed out

Build info: version: '4.11.0', revision: '040bc5406b'

System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.4.0-150-generic', java.version: '17.0.6'

Driver info: driver.version: ChromeDriver

at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:151)

at org.openqa.selenium.manager.SeleniumManager.getDriverPath(SeleniumManager.java:273)

at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:22)

This is the docker file used

Use the official OpenJDK 17 image as a base image

FROM maven:3.9.6-eclipse-temurin-17-alpine AS builder

//Set the working directory inside the container

WORKDIR /app

RUN chmod -R 777 /app

//Install tools.

RUN apt update -y & apt install -y wget unzip

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get install -y tzdata

//Install Chrome.

RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -

RUN sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'

RUN apt-get update

RUN apt-get install -y google-chrome-stable

//install chromedriver

RUN apt-get install -yqq unzip

RUN wget -O /tmp/chromedriver.zip http://chromedriver.storage.googleapis.com/`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`/chromedriver_linux64.zip

RUN unzip /tmp/chromedriver.zip chromedriver -d /usr/local/bin/

Copy the entire project (assuming Dockerfile is in the project root)

COPY . .

//Build the application using Maven

RUN mvn package -DskipTests

//Use the official OpenJDK 17 image as the final image

FROM eclipse-temurin:17.0.6_10-jdk@sha256:13817c2faa739c0351f97efabed0582a26e9e6745a6fb9c47d17f4365e56327d

//Set the working directory inside the container

WORKDIR /app

//Copy the JAR file from the build stage to the final stage

Copy the JAR file and other necessary files to the container

COPY report-automation.jar /app/report-automation.jar

COPY src/main/resources/META-INF/MANIFEST.MF /app/META-INF/MANIFEST.MF

COPY src /app/src

COPY src/main/resources/META-INF/MANIFEST.MF /app/META-INF/MANIFEST.MF

COPY src/main/resources/config.properties /app/config.properties

COPY pom.xml /app/pom.xml

COPY testng.xml /app/testng.xml

COPY application.properties /app/application.properties

COPY Configuration.xlsm /app/Configuration.xlsm

COPY apache-maven-3.9.6/ /app/apache-maven-3.9.6/

COPY Downloads /app/Downloads

COPY Logs /app/Logs

COPY report /app/report

COPY Reports /app/Reports

//Expose the port (if your application listens on a specific port)

EXPOSE 8080

//Set the entry point for the container (replace with your main class)

ENTRYPOINT ["java", "-jar", "report-automation.jar"]

Code level configurations as mentioned below

u/Listeners(ExtentReportListener.class)

public class BasePage {

protected WebDriver driver;

private final Properties config = new Properties();

public static Logger logger = LogManager.getLogger(BasePage.class);

public ChromeOptions getOptions() {

ChromeOptions options = new ChromeOptions();

Map<String, String> prefs = new HashMap<>();

prefs.put("download.default_directory", config.getProperty("absoluteDownloadLocation"));

options.setExperimentalOption("prefs", prefs);

options.addArguments("--remote-allow-origins=*");

options.addArguments("--headless");

return options;

}

u/BeforeClass

public void openBrowser() throws InterruptedException

Thread.sleep(2000);

driver = new ChromeDriver(getOptions());

driver.manage().window().maximize();

driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

}

u/BeforeTest

public void ClearFolders() throws IOException {

File dictionary = new File(config.getProperty("absoluteDownloadLocation"));

FileUtils.cleanDirectory(dictionary);

}

u/AfterClass

public void closeBrowser() throws InterruptedException {

Thread.sleep(2000);

driver.quit();

createBackUpFile();

}

}


r/SeleniumJava • • Jan 23 '24

How to setup Selenium with Java in Visual studio?

1 Upvotes

Hi How to setup Selenium with Java in Visual studio?


r/SeleniumJava • • Dec 04 '23

I hear of and see this a lot - Imposter Syndrome.

1 Upvotes

My friends, we are all of us, just singular humans trying to understand the world around us the best we can with the little knowledge we are capable of storing in our biochemical hard-drives (soft-drives?). None of us is capable of knowing everything about everything. Every day we push ever forward towards a future where we will know everything we want or need to know, and that is the best any of us can do. Until that day, you just have to take it one day at a time. Baby steps, take each new thing you have to learn, and one at a time piece by piece learn that thing. Eventually, you'll look back on the days when you had imposter syndrome, or to those who are currently experiencing it and say, I did it, so can you.

You can do it, just keep plugging away friend.


r/SeleniumJava • • Nov 26 '23

need help with StaleElementReferenceException

Thumbnail self.javahelp
1 Upvotes

r/SeleniumJava • • Nov 15 '23

How do I count the number of times a looping Selenium script has been run in the Script itself?

1 Upvotes

As the title says guys...

Im looping my Selenium script 200 times with the cmd "times".

Is there another command I can place at the end of my code that will count and show me live how often the script has looped already?

Thanks for your help!


r/SeleniumJava • • Oct 12 '23

I need some Load Testing recommendations...

1 Upvotes

We are not a big company but we provide service to very large groups of users in the hundreds of thousands. There is just no budget for load testing at the moment as we're starting from scratch. I can't test for hundreds of thousands of users and I feel like I shouldn't have to test that many users can all access the program at once. How do I realistically design a load test that would provide me with the data to make the statement "our product can handle 100,000 users." without testing 100,000 users all connecting at the same time?

I don't have any data to tell me how many users are actually using the product at any given time - which would help immensely in determining the amount of users needed in testing. I don't believe that we ever actually have hundreds of thousands of users all on at the same time anyway, but that's not really the point, I need to test what I can.

I'm considering using Jmeter (as if I have a choice) and to that end I have set up some simple tests running on my VM. It's become clear one PC will not be able to handle more than 100 users (at least not our PC's). So, I'm left having to rethink much of this and I'm turning to you for suggestions.

How do I approach this?


r/SeleniumJava • • Sep 21 '23

Selenium can’t find download system files

1 Upvotes

I am working on a corporate automation suite and we have ran into an issue that no one seems to be able to solve.. our automation or OPs team.

We are trying to download a file from our website and verify its contents and so we need it send from the node to our local machine.. and the error we are getting is “script timeout” “Cannot find downloads file system for session id:(a session id)”

Our selenium grid version is 4.10.0 and is ran on aws, our ops team is using terraform, helm and kubernetes. We also have Linux nodes running.. and working with Java. Also have se:downloadsEnabled enabled in code and on the grid.. also already tried changing the download directory.

We are using the code from this website to try to download the file from the node and unzip it into a folder so that we can verify said file.. https://www.gridlastic.com/selenium-download-files.html

My questions are:

  1. is anyone willing to show me how they are able to download a file from a selenium grid node and into a folder for verification?

  2. Is there any connections that I’m missing or could be causing issues when trying to download from a node with AWS/kubernetes?

  3. Could the fact that we are trying to work on Linux nodes that I am missing something to make the connection work?

Any help would be so much appreciated, beeen working on this for months with ops team and haven’t made any progress. :(


r/SeleniumJava • • Sep 04 '23

Different Game Testing Methods

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Aug 29 '23

Hyperautomation in Testing: What's the future?

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Aug 24 '23

Is non-functional testing important?

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Aug 10 '23

Testsigma’s Low-Code API Testing

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Aug 07 '23

Automation testing with ChatGPT

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Aug 02 '23

How to Boost Software Testing Speed

1 Upvotes

Several Methods for Speeding Up Software Testing

  1. Optimizing the Test Suite: One of the most crucial elements in quickening software testing is test suite optimization. Here are some considerations to bear in mind:

  • Pick the most crucial test cases to run first when prioritizing test execution. This ensures that critical functionality is thoroughly tested at an early stage.

  • Parallel evaluation: Reduce the overall execution time by running numerous tests concurrently utilizing parallel testing approaches.

  • Test Selection: Examine the impact and dependencies of code modifications to determine which tests are relevant and execute them only when necessary. This approach saves time by avoiding needless tests.

  1. Test Data Management: A successful test data management strategy can have a significant impact on testing speed. Consider the following methods:

  • To assure the prompt availability of required data sets, automate the development of test data.

  • To boost the process of...... (Read More)


r/SeleniumJava • • Jul 25 '23

Breaking Free from Code Constraints with Scriptless Automation Testing

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Jul 20 '23

RPA importance in Healthcare Operations

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Jul 17 '23

Tips & Best Practices To Know Before Automating Your Testing Work

Thumbnail
testorigen.com
1 Upvotes

r/SeleniumJava • • Jul 13 '23

Advantageous Landscape of Integrating IoT and ERP

Thumbnail
testorigen.com
1 Upvotes