Found 719 Articles for Testing Tools

Error:selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH using Selenium

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:44:22

2K+ Views

We can get the error selenium.common.exceptions.WebDriverException if the path of the chromedriver.exe executable file is not set properly or incorrect within the webdriver.Chrome(). The below image shows such an exception.It can be resolved by the following ways −Verify the path of the chromedriver.exe file set within webdriver.Chrome.Install the webdriver manager with the command: pip install webdrivermanager. Then add the statement: from webdriver_manager.chrome import ChromeDriverManager in our code.ExampleCode Implementation with webdriver managerfrom selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager #configure webdriver manager driver = webdriver.Chrome(ChromeDriverManager().install()) driver.implicitly_wait(0.5) #launch URL driver.get("https://www.tutorialspoint.com/index.htm") print("URL is: ") print(driver.current_url) driver.close()OutputRead More

How does Selenium Webdriver handle the SSL certificate in Safari?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:43:55

288 Views

Selenium webdriver is capable of handling SSL certificate in the Safari browser. This is done with the help of the DesiredCapabilities class. We shall create an object of this class. Then apply the setCapability method on it and set the value of property CapabilityType.ACCEPT_SSL_CERTS to true.The SSL is a protocol developed to have a secure connection between the server and the client browser. It verifies the website authenticity before any further communication with it.SyntaxDesiredCapabilities pc = DesiredCapabilities.safari(); pc.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);Exampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.safari.SafariDriver; import java.util.concurrent.TimeUnit; import org.openqa.selenium.remote.DesiredCapabilities; public class SSLErrorSafari{    public static void main(String[] args) { ... Read More

How to search for a keyword in google using Selenium Java?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:40:35

4K+ Views

We can search for a keyword in Google using Selenium webdriver in Java.In order, to perform a search, we have to first land on the Google page with the help of the get method.Then identify the search edit box with the help of any of the locators like id, name, class, xpath, tagname, or css. Then enter the keyword in the search box with the help of the sendKeys method.Finally, perform the keyword search by simulating ENTER keypress. This is done by using the sendKeys method and passing the parameter Keys.ENTER or Keys.RETURN.SyntaxWebElement r = driver.findElement(By.className("q")); r.sendKeys("Cypress"); r.sendKeys(Keys.RETURN);Exampleimport org.openqa.selenium.By; import ... Read More

How to Select date from a datepicker with Selenium Webdriver using Python?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:40:10

9K+ Views

We can select a date from a datepicker with Selenium webdriver using Python. To identify a particular date, first we have to use the find_elements method and identify all the dates having a common locator value.The find_elements returns a list of matching elements. We have to iterate through this list and search for the date which meets our criteria. Once we get that date, we would select it. Then break out from this iteration.Examplefrom selenium import webdriver #set chromodriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe") driver.implicitly_wait(0.5) #launch URL driver.get("https://jqueryui.com/datepicker/") #switch to frame l = driver.find_element_by_xpath("//iframe[@class='demo-frame']") driver.switch_to.frame(l); #identify element inside frame d= driver.find_element_by_id("datepicker") ... Read More

How to automate Calendar using Selenium WebDriver for Testing?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:38:25

3K+ Views

We can automate a calendar using Selenium webdriver. It may be a bit difficult to automate tests on a calendar since the selection of day, month, and year can be different in web UI from one calendar to another.A calendar can be in the form of a dropdown selection or with backward and forward buttons to select up and down in dates or with any other features. Let us see an example of selection of the 03/02/2021(2nd March, 2021) date in the below calendar −In the above example, the calendar is within a table. A table is represented by ... Read More

What is the command used to register gecko driver in Selenium?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:36:49

278 Views

We can register a gecko driver with Selenium webdriver. For the Firefox versions greater than 47, we can execute tests in Firefox with the geckodriver.exe file. To download this executable file, visit the below link − https://github.com/mozilla/geckodriver/releasesNext, we have to choose the link of the zip file which is compatible with our local operating system. As the download of the zip file is done, it has to be extracted and the file – geckodriver.exe should be saved in a location.To register this geckodriver.exe file, we have to set the path of the geckodriver.exe file with the System.setProperty method. Also we ... Read More

How can Selenium select each div separately that have the same class?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:35:37

5K+ Views

We can select each div separately that have the same class with the help of the Selenium webdriver. Often in the html code, we find more than one div element having a class attribute with the same value.Let us see the html code of elements with div tag having the same value set for the class attribute (as highlighted in the image). The value of the class attribute is - colsm-5 col-xs-8 store-details sp-detail paddingR0.To identify each of these div elements separately, we shall use the method findElements and pass the value of the class attribute as a parameter to ... Read More

Is there any way to load an extension in chrome browser using Selenium Webdriver?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:31:48

713 Views

We can load an extension in Chrome browser using Selenium webdriver.While we are using the Chrome browser in our local system, we can add multiple extensions to it.However, while Chrome browser is launched by Selenium webdriver, those extensions which are available to our local browser may not be present. We have to explicitly add them with the help of the .crx file of the extensions.To add an extension for example, Momentum, navigate to the below link − https://chrome.google.com/webstore/category/extensions.Type Momentum in the search box and hit Enter. Select the correct option from the search results.As the next page is navigated, we ... Read More

What are the benefits of using Selenium as an Automation Testing tool?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:29:37

299 Views

The benefits of using Selenium as an automation testing tool are listed below −It is open-source and comes free without licensing cost.It can used be used with more than one programming languages like C#, Java, Python, JavaScript, and so on.It can be used in more than one platforms like Windows, Mac, Linux, and so on.It can be used for testing an application in more than one browser like Chrome, Firefox, IE, Safari, and so on.It has a big community assistance for resolving users' queries.It can support record and playback features with the help of Selenium IDE.It can reduce use of ... Read More

How to select the text of a span on click in Selenium?

Debomita Bhattacharjee
Updated on 08-Apr-2021 07:28:57

18K+ Views

We can select the text of a span on click with Selenium webdriver. To identify the element with span tag, we have to first identify it with any of the locators like xpath, css, class name or tagname.After identification of the element, we can perform the click operation on it with the help of the click method. Then obtain its text with the text method. Let us investigate the html code of a webelement with a span tag.Examplefrom selenium import webdriver #set chromodriver.exe path driver = webdriver.Chrome(executable_path="C:\chromedriver.exe") driver.implicitly_wait(0.5) #launch URL driver.get("https://www.tutorialspoint.com/index.htm") #identify element and enter text e = driver.find_element_by_class_name("search") e.send_keys("tutorialspoint@gmail.com") ... Read More

Advertisements