0

I created a Selenium automated script using Java.

I developed this script in Eclipse and whenever I want to run the script I have to open eclipse and then I run it.

As all necessary Jars are required to run Selenium Java script but I would like an executable file for the same such that I click on the script it will start executing and will do all the work by itself.

Is it possible ?

As of now my script is opening my mail and entering email id and password and then it's clicking on login button.

Many thanks for your help.

2 Answers 2

1

You can make it in several steps:

  • add all steps in main method
  • build jar file
  • write .bat file to run your jar file(java doesn't create executable files). There are a lot of how do it in web
Sign up to request clarification or add additional context in comments.

Comments

0

Put your java code in a Maven project.

use maven-assembly-plugin

<build>
  <plugins>
    <plugin>
      <artifactId>maven-assembly-plugin</artifactId>
      <configuration>
        <archive>
          <manifest>
            <mainClass>fully.qualified.MainClass</mainClass>
          </manifest>
        </archive>
        <descriptorRefs>
          <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
      </configuration>
    </plugin>
  </plugins>
</build>

after in a .bat file (on Windows) or .sh file (on Unix):

java -jar yourJarFile.jar

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.