
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 517 Articles for Selenium

2K+ Views
We can download a file at a specified location through Python and Selenium using the chromedriver. 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.Syntaxop = webdriver.ChromeOptions() p = {'download.default_directory':'C:\Users\ghs6kor\Downloads\Test'} op.add_experimental_option('prefs', p)Examplefrom selenium import webdriver from selenium.webdriver.chrome.options import Options #object of ChromeOptions class op = webdriver.ChromeOptions() #browser preferences p = {'download.default_directory':'C:\Users\ghs6kor\Downloads\Test'} #add options to browser op.add_experimental_option('prefs', p) #set chromedriver.exe path ... Read More

810 Views
We can start Safari with extension using SafariDriver in Selenium webdriver. Safari is a prominent browser and is provided by default by Apple devices. For Safari versions 10 and greater than 10, the safaridriver comes automatically and is not required to be installed separately.The location of the SafariDriver is: /usr/bin/safaridriver. Also, it must be remembered that to work with the Safari latest version, users should have the Apple machine. This is because the Apply no longer supports Safari on Windows (from 2012).If we are using an older version of Safari in the Apple machine, we have to turn on the ... Read More

67K+ Views
We can do HTTP basic authentication URL with @ in password. 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 should be 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_auth Here, the username and password value is admin. URL is www.the-internet.herokuapp.com/basic_auth Example import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; public class BrwAuthnPopup{ ... Read More

263 Views
There is a relationship between Selenium RC and Selenium webdriver. Prior to the introduction of Selenium webdriver, there was extensive usage of Selenium RC.Both the tools, supported automation tests to be executed in multiple browsers. Also, multiple programming languages can be used to implement the test cases. However, there are differences between them as 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 ... Read More

777 Views
We can perform browser plugin testing with Selenium webdriver. We can have single or 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 available. To configure an extension, we have to obtain the .crx extension file of the extension.Then we have to add the extension to the Chrome browser which is launched by Selenium. To get all the extensions available to the browser type chrome://extensions on the browser address bar.To get add ... Read More

1K+ Views
We can maximize the browser window with Selenium webdriver in C#. This can be done with the help of the Maximize method. We shall launch the browser and then apply this method on the driver object.Syntaxdriver.Manage().Window.Maximize();For implementation we shall be using the NUnit framework.Exampleusing NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Firefox; using System; namespace NUnitTestProject1{ public class Tests{ String u = "https://www.tutorialspoint.com/index.htm"; IWebDriver d; [SetUp] public void Setup(){ //creating object of FirefoxDriver d = new FirefoxDriver(); } ... Read More

7K+ Views
We can perform Selenium testing without a browser. This is achieved by triggering the execution in a headless mode. The headless execution can decrease the utilization of key resources and is being adopted widely.For triggering headless execution in Chrome, the ChromeOptions class is utilized to modify the default browser characteristics. Headless is passed as a parameter to the addArguments.SyntaxChromeOptions opt = new ChromeOptions(); opt.addArguments("headless"); WebDriver d = new ChromeDriver(opt);ExampleCode Implementation.import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import java.util.concurrent.TimeUnit; public class WithoutBrowsr{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); //ChromeOptions object ChromeOptions opt ... Read More

2K+ Views
We can pass options to the Selenium Chrome driver using Python. This can be with the help of the ChromeOptions and the DesiredCapabilities class. For the ChromeOptions, we have to create an object for that class.Then we shall take the help of the add_argument method and pass the option we want to send to the browser as a parameter to the method. Finally, this information must be given to the web driver.ExampleCode Implementation.from selenium import webdriver from selenium.webdriver.chrome.options import Options as ChromeOptions #object of ChromeOptions op = webdriver.ChromeOptions() #add option op.add_argument('--enable-extensions') #pass option to webdriver object driver = webdriver.Chrome(chrome_options=op)We can ... Read More

2K+ Views
We can save and load cookies with Selenium webdriver in Python. A cookie is an information saved by the browser about the application. A cookie is stored in a key value pair.It is generally used to hold the credentials of users. It also stores information about the user actions on the browser within the cookie file. We can add, obtain and delete cookies of the browser.Syntaxc = driver.get_cookies() ck = { 'name': 'Selenium', 'value': 'Java'} driver.add_cookie(ck)ExampleCode Implementationfrom selenium import webdriver driver = webdriver.Chrome (executable_path="C:\chromedriver.exe") driver.maximize_window() driver.get("https://www.tutorialspoint.com/index.htm") #get current cookies c = driver.get_cookies() print(c) #count cookies with len method print(len(c)) # ... Read More

742 Views
We can send cookies with Selenium webdriver. A cookie is stored in a key value pair. First, we have to add cookies, then can delete them. We can also get the cookies.Also, we have to add import org.openqa.selenium.Cookie statement for cookie implementations.SyntaxCookie ck = new Cookie("Automation", "QA"); driver.manage().addCookie(ck); driver.manage().getCookies(); driver.manage().deleteAllCookies();ExampleCode Implementationimport java.util.Set; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.Cookie; import org.openqa.selenium.chrome.ChromeDriver; import java.util.concurrent.TimeUnit; public class CookiesSend{ public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "C:\Users\ghs6kor\Desktop\Java\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().timeouts().implicitlyWait(4, TimeUnit.SECONDS); driver.get("https://www.tutorialspoint.com/index.htm"); // cookie set ... Read More