Normally to run webdriver, we just need a browser and a selenium server jar file.
Selenium by-default supports Mozilla Firefox browser. Then the next question come to your mind is How to run webdriver in other browsers.
Selenium by-default supports Mozilla Firefox browser. Then the next question come to your mind is How to run webdriver in other browsers.
Selenium supports to run webdriver in other browsers by just adding an .exe path of the driver server for the individual browsers.
Now to run selenium webdriver in Chrome browser, we need to take the help of ChromeDriver which is a separate executable that selenium webdriver uses to control chrome. ChromeDriver is supported by the Chromium team, ChromeDriver is a standalone server which implements WebDriver's wire protocol for Chromium.
First of all, download latest version of ChromeDriver server for webdriver. You can download latest version of ChromeDriver server fromDownload Chrome Server
Note: Choose the chromedriver based on your working environment. If you are working on windows environment, you need to click on "Chromedriver_win32.zip".
Save the downloaded file to your local machine.
Save the downloaded file to your local machine.
In you code you need to set the system property for chrome driver as
System.setProperty("webdriver.chrome.driver", "pathofchromedriver\\chromedriver.exe");
System.setProperty("webdriver.chrome.driver", "pathofchromedriver\\chromedriver.exe");
Please find the below example program using java. After writing the below code, execute it to run your test in chrome browser
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class chromebrowser {
public static void main(String args[])
{
System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("http://seleniumeasy.com/");
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন