Found 719 Articles for Testing Tools

Download image with Selenium Python

Debomita Bhattacharjee
Updated on 02-Feb-2021 12:13:19

10K+ Views

We can download images with Selenium webdriver in Python. First of all, we shall identify the image that we want to download with the help of the locators like id, class, xpath, and so on.We shall use the open method for opening the file in write and binary mode (is represented by wb). Then capture the screenshot of the element that we desire to capture with the screenshot_as_png method.Finally, the captured image must be written to the opened file with the write method. Let us make an attempt to download the image of an element having the below html −Syntaxwith ... Read More

Find out when a download has completed using Python & Selenium

Debomita Bhattacharjee
Updated on 02-Feb-2021 12:06:23

6K+ Views

We can find when a download has completed with Selenium webdriver in Python. We shall use the ChromeOptions class for this purpose. First, we shall create an object of the ChromeOptions class.Then apply the add_experimental_option method on the object created. We shall pass browser preferences and download.default_directory: as parameters to that method. Finally, this information shall be passed to the driver object.Once the download is completed, we can verify it with the help of the os.path.isfile method. The path of the downloaded file is passed as a parameter to that method. The method os.path.exists shall also be used to verify ... Read More

Handling Browser Authentication using Selenium

Debomita Bhattacharjee
Updated on 04-Mar-2024 12:39:14

4K+ Views

We can handle browser authentication with Selenium webdriver. We have to pass the credentials appended with the URL. The username and password must be added with the format: https://username:password@URL. Let us make an attempt to handle the below browser authentication.Once the User Name and Password are entered correctly and the OK button is clicked, we are navigated to the actual page with the text Congratulations! You must have the proper credentials.Syntaxhttps://username:password@URL https://admin:admin@the−internet.herokuapp.com/basic_authHere, the username and password value is admin.URL is www.the−internet.herokuapp.com/basic_authExampleimport org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BrwAuthnPopup{    public static void main(String[] args) {     ... Read More

Where can I find a definitive Selenium WebDriver to Firefox Compatibility Matrix?

Debomita Bhattacharjee
Updated on 02-Feb-2021 12:01:19

199 Views

We can find a definitive Selenium webdriver to Firefox compatibility matrix. To verify the Firefox browser compatibility with the Selenium webdriver, note the Selenium webdriver version.Then navigate to the link −https://firefox−source−docs.mozilla.org/testing/geckodriver/Support.html.Verify the Firefox version needed for the Geckodriver and Selenium.For any compatibility related concerns, we can navigate to the link &minushttps://github.com/SeleniumHQ/selenium/blob/trunk/java/CHANGELOGAlso, there is a good matrix for support available in the link −https://github.com/santiycr/selenium−firefox−support−matrix

What is the difference between Selenium's Remote Control vs WebDriver?

Debomita Bhattacharjee
Updated on 02-Feb-2021 12:01:35

212 Views

The differences between Selenium RC and Selenium webdriver are listed below −FunctionalitiesSelenium RCSelenium WebdriverServerNeeds the server to trigger test execution.No need for the server to trigger test execution.Object OrientedNot much support from object oriented concepts.Majority of tests based on object oriented concepts.Dynamic LocatorsNo identification of elements with dynamic locators.Identification of elements with dynamic locators.AlertsNo support for alerts.Supports alerts.Mouse ActionsNo support for mouse actions.Supports mouse actions.DropdownNo support to handle dropdown.Supports handling dropdown.iPhone/AndroidNo support for iPhone/Android testing.Supports iPhone/Android testingListenerNo support for Listener.Supports Listeners.PerformanceIt does not communicate directly with the browser. So it is slower in execution.Execution is fast as it communicates directly ... Read More

Running chrome browser in inconginto Mode in Selenium

Debomita Bhattacharjee
Updated on 02-Feb-2021 11:51:03

12K+ Views

We can run Chrome browser Incognito mode with Selenium webdriver. Incognito mode is a safe mode of opening a browser. This can be done with the help of the DesiredCapabilities and ChromeOptions class.We shall create an object of the ChromeOptions class and apply addArguments method on it. Then pass −−incognito as a parameter to that method. We shall then create an object of the DesiredCapabilities class.We shall apply setCapability method on the object of the DesiredCapabilities class and pass the ChromeOptions.CAPABILITY and the object of ChromeOptions class as parameters to that method.Finally, this browser chrome profile shall be fed to ... Read More

How to deal with security certificates using Selenium?

Debomita Bhattacharjee
Updated on 02-Feb-2021 11:50:48

1K+ Views

We can deal with security certificates using Selenium webdriver. We can have certificates like the SSL certificate and insecure certificate. All these can be handled with the help of the DesiredCapabilities and ChromeOptions class.We shall create an object of the DesiredCapabilities class and apply setCapability method on it. Then pass the CapabilityType and value as parameters to that method.These general browser chrome profiles shall be fed to the object of the ChromeOptions class for the local browser with the help of the merge method. Finally, this information needs to be passed to the webdriver object.SyntaxDesiredCapabilities c=DesiredCapabilities.chrome(); c.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true); c.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); ... Read More

Why Selenium RC is deprecated?

Debomita Bhattacharjee
Updated on 02-Feb-2021 11:46:34

694 Views

Selenium RC is a key part in Selenium. It is a framework for testing that allows testers and developers to design test scripts in multiple languages to automate frontend UI test cases.It has a client library and a server that starts and quits the browser sessions by default.Selenium RC is deprecated because of the reasons listed below −Selenium RC comprises an additional layer of JavaScript known as the core which makes it slower.Selenium RC has complicated and redundant APIs.Selenium RC is not compatible with the HTMLUnit browser (required for headless execution).Selenium RC has in-built HTML report generation features for test ... Read More

How to get html with javascript rendered sourcecode by using Selenium?

Debomita Bhattacharjee
Updated on 02-Feb-2021 11:44:58

1K+ Views

We can get HTML with JavaScript rendered source code by using Selenium webdriver. Selenium can execute JavaScript commands with the help of the executeScript method.JavaScript command to be executed is passed as a parameter to the method. To obtain the HTML, with JavaScript, we shall pass return document.getElementsByTagName('html')[0].innerHTML as a parameter to the executeScript method.SyntaxJavascriptExecutor j = (JavascriptExecutor) driver; String s = (String) j.executeScript (return document.getElementsByTagName('html')[0].innerHTML");Exampleimport org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; import org.openqa.selenium.By; public class HTmlSrcJS{    public static void main(String[] args) {       System.setProperty("webdriver.chrome.driver",       "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe");       WebDriver driver = new ... Read More

Send keys without specifying element in Python Selenium webdriver

Debomita Bhattacharjee
Updated on 02-Feb-2021 11:43:14

1K+ Views

We can send keys without specifying elements in Python with Selenium webdriver. The tagname input is used for all the edit boxes. We shall use the find_element_by_tag_name method and pass input as a parameter to that method.Thus we need not mention element attributes explicitly. Let us investigate the html code of an element which can be identified with tagname input.Examplefrom selenium import webdriver #set geckodriver.exe path driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") driver.implicitly_wait(0.5) driver.get("https://www.tutorialspoint.com/index.htm") #identify element with tagname l = driver.find_element_by_tag_name("input") l.send_keys("Selenium") #obtain value obtained print("Value entered: ") print(l.get_attribute('value')) driver.quit()OutputRead More

Advertisements