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
Selenium Articles
Page 5 of 37
Modern Web Automation With Python and Selenium
We can have modern web automation with Python and Selenium. To configure with Selenium webdriver in Python the steps described below need to be followed −Step1 −To install Python in our system, visit the link − https://www.python.org/downloads/Step 2 − Click on the Download Python button. Once the download is completed, the Python executable file should be available in our system.Step 3 − Double-click on this executable file and the Python installation landing page should be opened. Click on Install Now.Step 4 − Python should be available in the below path −C:\Users\\AppData\Local\Programs\Python\PythonStep 5 − We shall configure the path of ...
Read MoreHow can I capture network traffic of a specific page using Selenium?
We can capture network traffic on a specific page using Selenium webdriver in Python. To achieve this, we take the help of the JavaScript Executor. Selenium can execute JavaScript commands with the help of the execute_script method.JavaScript command to be executed is passed as a parameter to this method. To capture the network traffic, we have to pass the command: return window.performance.getEntries() as a parameter to the execute_script method.Syntaxr = driver.execute_script("return window.performance.getEntries();")ExampleCode Implementationfrom selenium import webdriver #configure chromedriver path driver = webdriver.Chrome(executable_path='../drivers/chromedriver') #implicit wait driver.implicitly_wait(0.5) #url launch driver.get("https://www.google.com/") #JavaScript command to traffic r = driver.execute_script("return window.performance.getEntries();") for res in r: ...
Read MoreHow to set Proxy in Firefox using Selenium WebDriver?
We can set a proxy in Firefox using Selenium webdriver. A proxy server enables users to access an URL of an application for testing purposes even with the presence of several layers of network.The setting up of proxy in Firefox can be done with the help of the FirefoxOptions class. The port information and the proxy server host are added to this class. The setting up of the proxy server can also be done by configuring the Firefox Profile in the FirefoxProfile class.ExampleCode Implementation with the FirefoxOptionsimport org.openqa.selenium.Proxy; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.firefox.FirefoxOptions; public class ConfigureProxy { public ...
Read MoreHow to download all pdf files with selenium python?
Answer − We can download all pdf files using Selenium webdriver in Python. A file is downloaded in the default path set in the Chrome browser. However, we can modify the path of the downloaded file programmatically in Selenium.This is done with the help of the Options class. We have to create an object of this class and apply add_experimental_option. We have to pass the parameters - prefs and the path where the pdf is to be downloaded to this method. Finally, this information has to be sent to the webdriver object.Syntaxop = Options() p = {"download.default_directory": "../pdf"} op.add_experimental_option("prefs", p)ExampleCode ...
Read MoreHow to make seleinum jar file , and how to test using Selenium jar file?
We can make a JAR file with the code created in Selenium and share it among others. The procedure to make a Selenium Jar file and to test it are listed in the below steps −Step1 − Right-click on the Selenium project and click on Export.Step2 − Select the option Runnable Jar under the Java folder. Then click on Next.Step3 − Select the Java class for which we want to create a JAR in the Launch Configurations field. Enter the Export destination: field and select the option Extract required libraries into generated JAR. Then click on Finish.Step4 − Click on ...
Read MoreHow to Download & Install Selenium WebDriver?
We can download and install Selenium webdriver. This can be done with the following steps −Installation of Java JDK.Eclipse IDE installation.Installation of Selenium driver files.Installation of Java JDKStep1 − Navigate to the below link −https://www.oracle.com/java/technologies/javase-downloads.htmlStep2 − Click on JDK Download.Step3 − Depending on operating system we have, click on the link and complete the download −Step4 − Launch the Advanced System settings.Step5 − Click on the Environmental Variables button.Step6 − In the System Variables section, click on New and then type JAVA_HOME under the Variable name field and the path of the jdk in the Variable value field.Step7 − Scroll ...
Read MoreSelenium WebDriver Error: AttributeError: 'list' object has no attribute 'click'
We can get the Selenium webdriver error: AttributeError: 'list' object has no attribute 'click' while working on a test. Let us see an example of code where we have encountered such an error.ExampleCode Implementationfrom selenium import webdriver driver = webdriver.Chrome(executable_path='../drivers/chromedriver') #implicit wait driver.implicitly_wait(0.5) #url launch driver.get("https://www.tutorialspoint.com/index.htm") #identify an element m = driver.find_elements_by_name('search') m.click() #browser quit driver.quit()OutputIn the above code, we have got the error as we have used find_elements_by_name instead of find_element_by_name to perform a click operation on a single element. The method find_elements_by_name returns a list of elements.Here, we want to perform click operation on an element, so the ...
Read MoreHow to save as PDF on Chrome using Selenium
We can save a pdf file on Chrome using the Selenium webdriver. To download the pdf file in a specific location we have to take the help of the Options class.We shall create an object of this class and apply add_experimental_option on it. Then pass the values - prefs and the path where the pdf is to be downloaded as parameters to this method.Syntaxo = Options() o.add_experimental_option("prefs" , {"download.default_directory": "../downloads"} )ExampleCode Implementationfrom selenium import webdriver from selenium.webdriver.chrome.options import Options #object of Options o = Options() #path of downloaded pdf o.add_experimental_option("prefs", {"download.default_directory": "../downloads"}) #pass Option to driver driver = webdriver.Chrome(executable_path='../drivers/chromedriver', options=o) ...
Read MoreGet Started With Selenium and Python Automation
We can work on Selenium with Python bindings. To get started with Selenium and Python automation in Windows operating system, we need to follow the below steps −Step 1 − Navigate to the link https://www.python.org/downloads/ to download Python.Step 2 − Click on Download Python . Once it is done, the Python executable file should be downloaded in our system.Step 3 − Python installation landing page is launched once the executable file is clicked. Click on the Install Now button.Step 4 − Python gets downloaded in the below path −C:\Users\\AppData\Local\Programs\Python\PythonStep 5 − We need to set the path of the Python ...
Read MoreHow To Use TestNG Framework For Creating Selenium Scripts?
We can use the TestNG framework for creating Selenium scripts. TestNG is a testing framework built for the usage of both the developers and testers. The steps to integrate TestNG with Selenium scripts are listed below −Step1 − Click on the Help menu from Eclipse. Then click on Eclipse Marketplace.Step 2 − In the Eclipse Marketplace pop-up, input TestNG within the Find field and click on Go. Then click on Install.Step 3 − Accept the license agreement radiobutton and then click on Finish.Step 4 − Click on the Restart Now button.Step5 − Click on the File menu, then click on ...
Read More