Debomita Bhattacharjee

Debomita Bhattacharjee

590 Articles Published

Articles by Debomita Bhattacharjee

Page 57 of 59

How to take care of SSL certificate issues in chrome browser in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 694 Views

We can face SSL certificate issue because of the reasons listed below −While the website was developed, its SSL certificate was not proper.The site may have a self-signed certificate.SSL not configured properly at the server level.Exampleimport org.openqa.selenium.Capabilities; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; public class SSLCert {    public static void main(String[] args) {       // TODO Auto-generated method stub       //Desired capabilities for general chrome profile       DesiredCapabilities c=DesiredCapabilities.chrome();       c.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);       c.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);       //ChromeOptions for local browser       ...

Read More

How to use the Properties file to declare global variables in a framework in Selenium?

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

We can declare global variables in Selenium with the help of the Properties class which works with .properties file. In the .properties file, the data is stored in key value pairs. We can read and write values in the .properties file.Eaxmpleimport java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Propert {    public static void main(String[] args) throws IOException {       // TODO Auto-generated method stub       Propert t = new Propert();       t.login();    }    public void login() throws IOException {       Properties ...

Read More

How to verify if we can select multiple options in a static dropdown in Selenium?

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

We can verify if we can select multiple options in a static dropdown in Selenium with the help of isMultiple() method. It returns a Boolean value of true or false.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import java.util.List; import org.openqa.selenium.support.ui.Select; public class OptionsMultiple{ 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/tutor_connect/index.php"; Select s = new Select(driver.findElement(By.xpath("//select[@name=’selType’]"))); ...

Read More

How will you select a particular value in a dropdown without using the methods of Select class in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 5K+ Views

We can select a particular value in a dropdown using the method of Select class by using findElements() method.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import java.util.List; import org.openqa.selenium.support.ui.Select; public class OptionsClick{ 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/tutor_connect/index.php"; driver.get(url); driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS); // getting the list of elements ...

Read More

How to get all the options in the dropdown in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 11-Jun-2020 25K+ Views

We can extract all the options in a dropdown in Selenium with the help of Select class which has the getOptions() method. This retrieves all the options on a Select tag and returns a list of web elements. This method does not accept any arguments.Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; import java.util.List; import org.openqa.selenium.support.ui.Select; public class DropdownOptions{ 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/tutor_connect/index.php"; ...

Read More

What are the various methods available under Select class in Selenium?

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

The various methods available under Select class in Selenium are listed below −selectByVisibleText(String args)This method is most commonly used in dropdowns. It is very simple to select an option in a dropdown and multiple selection box with this method. It takes a String parameter as argument and returns no values.Syntax −Select s = new Select(driver.findElement(By.id(">"))); s.selectByVisibleText("Selenium");selectByIndex(String args)This method takes the index of the option to select in the dropdown. It takes an int parameter as argument and returns no values.Syntax −Select s = new Select(driver.findElement(By.id(">"))); s.selectByIndex(1);selectByValue(String args)This method takes the value of the option to select in the dropdown. It ...

Read More

How to enter a letter in uppercase in the edit box using Actions in Selenium?

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

We can enter a letter in upper case in the edit box in Selenium with the help of Actions. In order to achieve this, we need to first move to the edit box, then click() on that field. Then press SHIFT and enter the letters using sendKeys() method. Finally use build().perform() to execute all the steps.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 org.openqa.selenium.interactions.Action; import org.openqa.selenium.interactions.Actions; import java.util.concurrent.TimeUnit; public class UpperCase{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = ...

Read More

How to perform mouseover action on an element in Selenium?

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

We can perform mouseover action on elements in Selenium with the help of Actions class. In order to perform the mouse movement we will use moveToElement () method of the Actions class. Finally use build().perform() to execute all the steps.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 org.openqa.selenium.interactions.Action; import org.openqa.selenium.interactions.Actions; import java.util.concurrent.TimeUnit; public class MouseOver{ 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/questions/index.php"; ...

Read More

How to count the number of frames in a page in Selenium?

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

We can count the number of frames in Selenium by the methods listed below −With the help of List with tagname frame/iframe.With the help of a Javascript executor.ExampleWith tagname.import 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.List; public class FrameCount{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       String url =       "http://the-internet.herokuapp.com/nested_frames";       driver.get(url);       driver.manage().timeouts().implicitlyWait(12, TimeUnit.SECONDS);       //By finding list of the web elements using frame or ...

Read More

How to handle popup windows in Selenium?

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

Selenium has getWindowHandles() method , which returns all the window handle ids for all the open windows. This is stored in Set data structure in String data types.In order to navigate to a specific window, we need to traverse to the window we want to access with the iterator() method then switch to that window.getWindowHandle() method gives the window handle id of the current window Id.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; import java.util.List; import java.util.Set; import java.util.Iterator; import org.testng.annotations.Test; public class WindowHandles{    @Test    public void windowHandle() throws Exception {       ...

Read More
Showing 561–570 of 590 articles
Advertisements