Found 719 Articles for Testing Tools

How does Selenium Webdriver handle SSL certificate in Firefox?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:56:33

1K+ Views

We can handle SSL certificate in Firefox with the help of the Selenium webdriver by using the FirefoxProfile class. Then setting the parametersetAcceptUntrustedCertificates to true. A SSL is a protocol followed to create a secure connection between the client (browser) and the server.SSL checks the authenticity of a website and encodes the visitors while they send or get information from the site. Some of the advantages of SSL certificates are −Earns the users trust by increasing the business growth.Provides a secure gateway for online payment by securing the customer data like username, password, and other banking information.Keeps away from hacker ... Read More

How to handle SSL certificate error using Selenium WebDriver?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:56:05

827 Views

We can handle SSL certificate error using Selenium webdriver while we try to launch a web page based on HTTP. SSL certificate errors are encountered in multiple browsers like Chrome, Safari, and Firefox and so on.SSL certificate error comes up if the site we are making an attempt to access has an outdated, invalid or an untrusted certificate. SSL or Secure Sockets Layer is a protocol followed to create a connection between the client (browser) and the server.To handle the SSL certificate error we have to use the DesiredCapabilities class and then accept the SSL error by setting the ACCEPT_SSL_CERTS ... Read More

Is it possible to scroll down in a webpage using Selenium Webdriver programmed on Python?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:49:19

3K+ Views

Yes it is possible to scroll down in a webpage using Selenium webdriver in Python by using the JavaScript Executor. Selenium can execute JavaScript commands with the help of execute_script method.The JavaScript command to be used is passed as a parameter to this method. Also, it must be noted that scrolling actions cannot be performed directly with any methods in Selenium.To scroll down in a page to the end, we have to pass the command window.scrollTo as a parameter to the execute_script method. Also, the values 0 and document.body.scrollHeight are passed as parameters to the window.scrollTo command.Syntaxdriver.execute_script("window.scrollTo(0, document.body.scrollHeight);")Let us scroll ... Read More

How to automate menu box/pop up of right click in Python Selenium?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:48:55

710 Views

We can automate right click action with Selenium webdriver in Python by using the ActionChains class. We have to create an object of the ActionChains class and then apply the relevant method on it.In order to move the mouse to the element on which right click is to be performed, we shall use the move_to_element method and pass the element locator as a parameter.Then apply context_click method to perform the right click. Finally, use the perform method to actually carry out these actions. Also, we have to add the statement from selenium.webdriver.common.action_chains import ActionChains in our code to work with ... Read More

How can I perform mouse hover action in Selenium-Python?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:46:17

16K+ Views

We can perform mouseover action in Selenium webdriver in Python by using the ActionChains class. We have to create an object of this class and then apply suitable methods on it.In order to move the mouse to an element, we shall use the move_to_element method and pass the element locator as a parameter. Then apply the perform method to actually perform this action. After hovering on the element, we can apply click action on it with the help of the click method.Syntaxa = ActionChains(driver) m= driver.find_element_by_link_text("Enabled") a.move_to_element(m).perform()Let us try to hover on the element Enabled as shown on the below ... Read More

Need Selenium to wait until the document is ready

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:44:07

5K+ Views

We can wait until the document is ready (page loaded completely) in Selenium by applying the method pageLoadTimeout. The wait time is passed as a parameter to this method.The webdriver waits for this duration for the page to load completely. If this time gets elapsed without page loading, a TimeoutException is thrown.Syntaxdriver.manage().timeouts().pageLoadTimeout(3, TimeUnit.SECONDS);ExampleCode Implementation with pageLoadTimeoutimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class PageLdTime{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ChromeDriver();       //page load ... Read More

Scroll element to the middle of the screen with Selenium

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:42:35

4K+ Views

We can scroll to the middle of the screen with Selenium webdriver using the JavaScript Executor. Selenium can execute JavaScript commands with the help of the executeScript method.To scroll to the middle of the screen, we have to first identify the element upto which we want to scroll on the page. Then pass scrollIntoView and the web element as parameters to the executeScript method.JavaScript command scrollIntoView can have multiple optional parameters. They are −behavior – This can have the values - smooth or auto. It describes the animation of the transition. The default value is auto.block – This can have ... Read More

How can I download Microsoft WebDriver/Edge Driver to use with Selenium?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:29:20

3K+ Views

We can download Microsoft/Edge Driver to use with Selenium. The Microsoft Edge driver allows communication of the tests developed in Selenium with the Edge browser.To download the msedgedriver.exe file, we have to first navigate to the following link − https://developer.microsoft.com/en-us/microsoftedge/tools/webdriver/#downloadsThen move to the Downloads section, and click on the link based on the local operating system and browser version we have.Once the download is completed, a zip file gets saved. It needs to be extracted and stored in a location. After extracting it, the executable file - msedgedriver.exe file is to be kept at a desired location.We have to configure ... Read More

What is the best way to handle a Javascript popup using Selenium Webdriver?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:28:04

444 Views

We can handle a JavaScript pop-up using Selenium webdriver with the help of the Alert interface. The alerts are pop-ups that shift the focus from the main webpage to the alert text appearing on the page.By default, the webdriver has focus on the main page, to access the alert we have to explicitly switch the driver focus from the main page to the alert box. The alerts can be of two types – web based and window based. JavaScript pop-ups are the web based alerts.The switchTo().alert() method is used to switch the driver focus to the alert. Once the driver ... Read More

How to avoid “StaleElementReferenceException” in Selenium?

Debomita Bhattacharjee
Updated on 06-Apr-2021 11:27:24

491 Views

The StaleElementReferenceException is thrown if the webdriver makes an attempt to access a web element which is currently not available or invalid in DOM.This can be due to refresh of the page or an element is accidentally deleted or modified or no longer connected to DOM. This type of exception can be avoided by following the below techniques −Page refresh.Having a retry mechanism.Having a try-catch block.Waiting for some expected criteria like presenceOfElementLocated or refreshing a page on getting a stale condition for an element.ExampleCode Implementation having StaleElementExceptionimport 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; public class StaleElemntExc{   ... Read More

Advertisements