What is Selenium?
-It is an open source automation tool
-Available in the form of APIs
-Support multiple languages
-Supports only web application
-Support multiple browsers
How to launch a browser using selenium?
First we need to set the property of the browser using System.setProperty as below:
System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
We need to create the object of the driver as below:
WebDriver driver=new ChromeDriver();
Here WebDriver is the Interface in Selenium and ChromeDriver is an existing class.
Different Locators in selenium.
There are eight locators in selenium. We can prioritise the locators as below:
1.id
2.cssSelector
3.xpath
4.name
5.className
6.linkText
7.partialLinkText
8.tagName
Xpath are of two types
Absolute XPath
Eg: html/body/div[1]/section/div[1]/div/div/div/div[1]/div/div/div/div/div[3]/div[1]/div/h4[1]/b
Relative XPath
Eg: //*[@class='featured-box']//*[text()='Testing']
Absolute xpath should not be used,only Relative Xpath should be used
-It is an open source automation tool
-Available in the form of APIs
-Support multiple languages
-Supports only web application
-Support multiple browsers
How to launch a browser using selenium?
First we need to set the property of the browser using System.setProperty as below:
System.setProperty("webdriver.chrome.driver", "./drivers/chromedriver.exe");
We need to create the object of the driver as below:
WebDriver driver=new ChromeDriver();
Here WebDriver is the Interface in Selenium and ChromeDriver is an existing class.
Different Locators in selenium.
There are eight locators in selenium. We can prioritise the locators as below:
1.id
2.cssSelector
3.xpath
4.name
5.className
6.linkText
7.partialLinkText
8.tagName
Xpath are of two types
Absolute XPath
Eg: html/body/div[1]/section/div[1]/div/div/div/div[1]/div/div/div/div/div[3]/div[1]/div/h4[1]/b
Relative XPath
Eg: //*[@class='featured-box']//*[text()='Testing']
Absolute xpath should not be used,only Relative Xpath should be used
No comments:
Post a Comment