Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 59 of 59

What are the different cookies methods in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 533 Views

The different cookies method in Selenium are listed below −driver.manage().deleteAllCookies() − This removes all cookies.driver.manage().deleteCookie(Id) − This removes a particular cookie.driver.manage().deleteCookieNamed(CookieName) − This removes a particular cookie based on Name.driver.manage().getCookies() − This returns all the cookies.driver.manage().getCookieNamed(CookieName) − This returns a particular cookie based on Name.driver.manage().addCookie(Id) − This adds a particular cookie.Code Implementation with some cookies method.Exampleimport org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class CookiesScripting {    public static void main(String[] args) {       // TODO Auto-generated method stub       System.setProperty("webdriver.chrome.driver",    "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       driver.manage().window().maximize();       // ...

Read More

How to maximize the browser in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 4K+ Views

We can maximize the browser in Selenium with the help of method maximize().The present active window becomes maximized with this method.Code implementation.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class BrowserMax {    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";       driver.get(url);       // maximizing browser with maximize()       driver.manage().window().maximize();       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);       driver.findElement(By.partialLinkText("Coding")).click();       driver.close();    } }

Read More

What is the difference between getWindowHandle() and getWindowHandles() in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 16K+ Views

getWindowHandle() and getWindowHandles() methods have some prominent differences.driver.getWindowHandles() – It stores the set of handles for all the pages opened simultaneously.driver.getWindowHandle() – It fetches the handle of the web page which is in focus. It gets the address of the active browser and it has a return type of String.Code ImplementationExampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import java.util.Set; import java.util.Iterator; import org.testng.annotations.Test; public class WindowHandles{    @Test    public void windowHandle() throws Exception {       System.setProperty("webdriver.chrome.driver", "C:\Selenium\chromedriver.exe");       WebDriver driver = new ChromeDriver();       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);     ...

Read More

How to get the value of the edit box in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 639 Views

We can get the value of the edit box in Selenium by the following ways −By using getText () method.Using the class JavascriptExecutor.Code Implementation with method getText ().Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class GetValueScripting {    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";       driver.get(url);       driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);       String text = driver.findElement(By.className("gsc-input")).getText();       System.out.println("Extracted text is " + text);       driver.close();   ...

Read More

How to submit a form in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 2K+ Views

We can submit a form in Selenium by the following methods −submit()click()Code Implementation with submit() method.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class SubmitScripting {    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "";       driver.get(url);       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);       // submit method to submit the form       driver.findElement(By.id("")).submit();       driver.close(); } }Code Implementation with method click().Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; ...

Read More

How to click on a link in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 3K+ Views

We can click a link in Selenium by the following locators along with click() method.By link text.By partial link text.Code Implementation with link text locator.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class LinkScripting {    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",    "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";       driver.get(url);       driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);       driver.findElement(By.linkText("Coding Ground")).click();       driver.close();    } }Code Implementation with partial link text locator.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; ...

Read More

What are the most basic steps to write a web driver script?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 137 Views

The most basic steps to write a web driver script are listed below −Open any browser by creating a webdriver reference pointing to the corresponding browser driver class.Launch any URL with the get() method.Pause for some time for the page load.Confirm that we are on the correct web page.Finally close the session.Code ImplementationExampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class WebScripting {    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url = "https://www.tutorialspoint.com/index.htm";     ...

Read More

List down the name of the Web drivers supported by Selenium.

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 1K+ Views

The name of the web drivers supported by Selenium are listed below −Google Chrome Driver [ ChromeDriver() supports chrome ]HTML Unit Driver [ WebClient() supports chrome, firefox and IE ]Safari Driver [ SafariDriver() supports Safari ]IOS Driver [ IOSDriver() supports ios ]Android Driver [ AndroidDriver() supports Android ]OperaChromium Driver [ ChromeDriver() supports opera ]Gecko Driver [ FirefoxDriver() supports firefox ]Microsoft WebDriver [ InternetExplorerDriver() supports IE ]EventFiring WebDriver [ EventFiring Driver() supports majority of browsers ]Code Implementation with Firefox driverExampleimport org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import java.util.concurrent.TimeUnit; public class BrowserDriverScript {    public static void main(String[] args) ...

Read More

Why does the Selenium WebDriver have an edge over Selenium RC?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 354 Views

Selenium was introduced as a part of version 1.0 of Selenium. Selenium WebDriver was introduced as a part of version 2.0 of Selenium. Selenium RC is deprecated and obsolete now. Though some users still use Selenium RC, the support for it is not there anymore.Selenium RC enabled the feature of recording scripts in multiple browsers namely Chrome, Safari, IE and so on. Also, it had communicated with the browser via the Selenium RC server.Selenium Web Driver supported cross browser testing and did not require the Selenium Server which enhanced its speed of execution. Overall Selenium RC had an architecture which ...

Read More

What is the Selenium Web Driver Architecture?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 10-Jun-2020 10K+ Views

Selenium Web Driver architecture in a simplified diagram is described below:Let us now understand the Selenium Web Driver Architecture. Selenium WebDriver API enables interaction between browsers and browser drivers. This architecture consists of four layers namely the Selenium Client Library, JSON Wire Protocol, Browser Drivers and Browsers.Selenium Client Library consists of languages like Java, Ruby, Python, C# and so on. After the test cases are triggered, entire Selenium code will be converted to Json format.JSON stands for Javascript Object Notation. It takes up the task of transferring information from the server to the client. JSON Wire Protocol is primarily responsible ...

Read More
Showing 581–590 of 590 articles
« Prev 1 55 56 57 58 59 Next »
Advertisements