Download File at Specified Location Using Python and Selenium

Debomita Bhattacharjee
Updated on 30-Jan-2021 11:57:16

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

Start Safari with Extension Using SafariDriver in Selenium

Debomita Bhattacharjee
Updated on 30-Jan-2021 11:55:34

820 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

Relationship Between Selenium RC and WebDriver

Debomita Bhattacharjee
Updated on 30-Jan-2021 11:51:54

270 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

Browser Plugin Testing with Selenium

Debomita Bhattacharjee
Updated on 30-Jan-2021 11:50:09

787 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

Maximize Browser Window in Selenium WebDriver Using C#

Debomita Bhattacharjee
Updated on 30-Jan-2021 11:47:14

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

Count of AP Arithmetic Progression Subsequences in an Array in C++

Sunidhi Bansal
Updated on 29-Jan-2021 08:42:04

606 Views

Given an array arr[] containing integer elements. The goal is to count the number of Arithmetic Progression subsequences inside arr[]. The range of elements inside arr[] are [1, 1000000].Empty sequence or single element will also be counted.Let us understand with examples.For ExampleInput - arr[] = {1, 2, 3}Output - Count of AP (Arithmetic Progression) Subsequences in an array are: 8Explanation - The following subsequences will form AP:-{}, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, {1, 2, 3}Input - arr[] = {2, 4, 5, 8}Output - Count of AP (Arithmetic Progression) Subsequences in an array are: 12Explanation - The following subsequences ... Read More

Count of Number of Given String in 2D Character Array in C++

Sunidhi Bansal
Updated on 29-Jan-2021 08:41:06

617 Views

The following problem is an example of daily newspaper crossword, here we are given a 2-Dimensional character array and the problem statement is to find out the given word from the 2-Dimensional character array maze.The search algorithm includes finding the individual characters from Top-to-Bottom, Right-to-Left and vice-versa but not diagonally.Let us understand with examplesInput- String word-LAYS2D String[ ] -  { "LOAPYS", "KAYSOT", "LAYSST",  "MLVAYS", "LAYSAA", "LAOYLS" };Output- Count of number of given strings in 2D character array: 7Explanation - As we are given with the string array of words and from them, we have to find the word “LAYS” which can ... Read More

Count Paths with Exact Weight X and Edge Weight M in C++

Sunidhi Bansal
Updated on 29-Jan-2021 08:35:48

192 Views

We are given a tree which can have endless levels, a variable child which will store the number of children a node can have, a variable weight which will store the weight associated with the path and a variable path that will store the path and task is to calculate the count of number of paths which has weights equals to the X and there must be an at least one edge with the given weight.For ExampleInput - int child = 4, weight = 4, path = 4; Output - Count of number of paths whose weight is exactly X and ... Read More

Count of Arrays Having Consecutive Elements with Different Values in C++

Sunidhi Bansal
Updated on 29-Jan-2021 08:35:13

432 Views

Given three variables size, max_val, last_element as input. The goal is to find the count of different arrays that can be formed in a manner such that they have size elements, have elements between 1 and max_val and the first element is always 1 and the last element is always max_val. Also make sure that no two consecutive elements are the same.Let us understand with examples.For ExampleInput - size = 5, max_val = 3, last_element = 3Output - Count of arrays having consecutive element with different values are: 5Explanation - The arrays will be:-[ 1, 2, 3, 1, 3 ], ... Read More

Count of Divisors with More Set Bits than Quotient in C++

Sunidhi Bansal
Updated on 29-Jan-2021 08:34:33

140 Views

We are given with an integer number let's say, N which is considered as a divisor and it will be divided with the numbers starting from the 1 - N and the task is to calculate the count of those divisors which have more number of set bits than the quotient when divided with the given number N.For ExampleInput - int N = 6Output - Count of divisors having more set bits than quotient on dividing N are: 5Explanation - Firstly, we will divide the number N with the numbers starting from 1 - N and calculate the set bits of ... Read More

Advertisements