Skip to main content

How to get start with selenium

selenium create your first automation test

The following three software are prerequisite to get stared with selenium.
  1. Java => Environment and programming language to write script
  2. Eclipse =>  To run script
  3. selenium => Framework to test script
  4. WebDriver => To run test in specific browser.
1. Java.
    Download java by clicking here and download latest JRE file according to you OS. After installing java add Environment variable to Jdk/Bin folder in my case it is C:\Program Files\Java\jdk-11.0.2\bin.
2 . Eclipse
             Download the eclipse from official website or click here.
3.selenium
    Go to selenium website by clicking here to download latest or download to download any previous version click here.  I went to 3.9 folder and downloaded two files.
  1. selenium-server-standalone-3.9.1.jar
  2. selenium-server-3.9.1.zip
Extract the zip in empty folder it will contain 2 jar file and some jar files in Lib folder we will need while setting up environment for Eclipse.
4. WebDrivers.
 Go to seleniumhq website  and navigate to Third Party Browser Drivers section and download the drivers according to your browser version.

Now we setup Eclipse environment so first lunch the eclipse and create java project and follow the steps.
  1.  Right click on JRE System Library.
  2. Click Build Path in new window and select configure build path as show in image
  3. A new window will be open click on ClassPath it will enable "Add External Jars" option click on it.
  4. Add selenium-server-standalone-3.9.1.jar which and downloaded while and also select all jar files from Libs folder and two root jar files which were extracted from selenium-server-3.9.1.zip.
  5. Click on Apply and close. That's it we are done with setup.
Now create the new package in your project by clicking on Src folder and paste the following code in and change the class and package name and also location of webDriver from to E:\\automation\\chromedriver.exe to your own browser driver location which was downloaded on step 4. After it you can run your first test by clicking on RUN button.
    package demo.packag;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;

public class demoClass {

public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "E:\\automation\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://www.gmail.com");
}

}

You can also take help from This link
For Element selector click here
action type select information click here





Comments

Popular posts from this blog

Recursive query in Laravel

<?php /** * Created by PhpStorm. * User: Zafar Hayat * Date: 6/26/2020 * Time: 7:06 PM */ namespace App\Services; use Illuminate\Support\Facades\DB; class FileWithDeepSearch { /** * @var PHPFunction */ private $PHPFunction ; /** * @var Common */ private $common ; /** * @var Filters */ private $filters ; public function __construct( PHPFunction $PHPFunction , Common $common , Filters $filters ) { $this -> PHPFunction = $PHPFunction ; $this -> common = $common ; $this -> filters = $filters ; } public function getQuery( array $data ) { $currentDirectoryFilesQuery = $this ->getCurrentDirectoryFilesQuery( $data ); $recursiveQuery = $this ->getRecursiveQuery( $data ); $recursiveQuery = $recursiveQuery ->unionAll( $currentDirectoryFilesQuery ); return $recursiveQuery ; } private function getCurrentDire...

How To Update PHP In XAMPP

 downloaded the version of PHP that I wanted (7.1.17) and then I strategically replaced the one I had in XAMPP with it. Here are the steps I followed. Download your desired PHP binary from  here . Make sure you download the same build type as your current version. If you don’t know what this is, go ahead and download an  x86 Thread Safe  version since most XAMPP installations have that build. In my case, I downloaded the 7.1.17 VC14 x86 Thread Safe  build. Extract the contents of the Zip file. Create a backup of your current  xampp/php  folder. I called mine php-backup7.1.2 Still inside /xampp, create a new php folder, then copy the contents of the extracted zip file into it. If you have custom configurations in the php.ini file, copy and replace it from your old php folder to the new one. If you didn’t previoisly edit the your php.ini, then skip this step. In my case I had previously installed drivers for sql server and defined them in my php....

Jmeter

JMeter Advantages Open source license : JMeter is totally free,  allows developer use the source code for the development Friendly GUI : JMeter is extremely easy to use and doesn't take time to get familiar with it Platform independent : JMeter is 100% pure Java desktop application. So it can run on multiple platforms Full multithreading framework . JMeter allows concurrent and simultaneous sampling of different functions by a separate thread group Visualize Test Result:  Test result can be displayed in a different format such as chart, table, tree and log file Easy installation : You just copy and run the *.bat file to run JMeter. No installation needed. Highly Extensible : You can write your own tests. JMeter also supports visualization plugins allow you to extend your testing Multiple testing strategy : JMeter supports many testing strategies such as  Load Testing , Distributed Testing, and  Functional Testing . Simulation : JMeter can simulate mul...