Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Testing Tools Articles
Page 33 of 52
Find out when a download has completed using Python & Selenium
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 MoreWhat is the difference between Selenium's Remote Control vs WebDriver?
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 MoreWhere can I find a definitive Selenium WebDriver to Firefox Compatibility Matrix?
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
Read MoreRunning chrome browser in inconginto Mode in Selenium
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 MoreHow to deal with security certificates using Selenium?
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 MoreWhy Selenium RC is deprecated?
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 MoreHow to get html with javascript rendered sourcecode by using Selenium?
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 MoreSend keys without specifying element in Python Selenium webdriver
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()Output
Read MoreUsing Extensions with Selenium & Python
We can use extensions with Selenium webdriver in Python. We can have multiple extensions of the Chrome browser while we manually open the browser and work on it.However, while the Chrome browser is opened through Selenium webdriver, those extensions which are available to the local browser will not be present. To configure an extension, we have to obtain the .crx extension file of the extension.Then we have to perform installation of the extension to the browser which is launched by Selenium. To get all the extensions available to the browser enter chrome://extensions on the browser address bar.To get add an ...
Read MoreHow do I send a DELETE keystroke to a text field using Selenium with Python?
We can send a DELETE keystroke to a text field using Selenium webdriver with Python. First of all, we have to identify the text field with the help of any locators like xpath, css, id, and so on.We can enter a text in the text field with the send_keys method. The value to be entered is passed as parameter to the method. To delete a key, we can pass Keys.BACKSPACE as a parameter to the send_keys method.Syntaxl = driver.find_element_by_id("gsc−i−id1") l.send_keys("Sel") l.send_keys(Keys.BACKSPACE)To delete all the keys entered simultaneously, we have to pass CTRL+A and BACKSPACE as parameters to the send_keys method.Syntaxl ...
Read More