selenium-webdriver

Change the default file download path for Edge using selenium

可紊 提交于 2021-02-08 10:46:28
问题 I was using selenium-ruby for automating browser application. I want to simulate file download scenario. When I want to execute for chrome I had a method named "download_path", its value can be changed at run-time and when download file it will be saved at my destination path. But, when I execute the same code for edge there is no method support for "download_path" in edge. Is there any way to set my default download location at runtime? Chrome Code: @browser = Selenium::WebDriver.for :chrome

How does FluentWait in Selenium implements the until() method

喜夏-厌秋 提交于 2021-02-08 10:14:56
问题 The syntax of the until() method in selenium docs is as below: public <V> V until(java.util.function.Function<? super T,V> isTrue) The usage of the same is like: WebDriver wait = new WebDriver(driver, 20); WebElement loginButton = wait.until(ExpectedConditions.elementToBeClickable(By.id("lgn-btn"))); I couldn't relate to the syntax and the usage of the until() method. I want to know how the syntax is implemented. Yeah, I know about Generics, which we use to know about the errors at compile

Select an option using python from select2 and fill web form

谁说胖子不能爱 提交于 2021-02-08 10:09:51
问题 I have this html code from select2 script: <div class='round10'> <select class='select2-authors-multiple' name='author[]' id='author' multiple style='width: 100%;'></select> and this from same page: <div class='round10'> <select class='select2-narrators-muliple' name='narrator[]' id='narrator' multiple='multiple' style='width: 100%;'></select> From firefox inspector i get this: <input class="select2-search__field" type="search" tabindex="0" autocomplete="off" autocorrect="off" autocapitalize=

Traverse links and sub-links by clicking on elements selenium python

☆樱花仙子☆ 提交于 2021-02-08 09:56:54
问题 I have a webpage which has multiple links and sub-links in flow as below To click on the child elements (2,7,8 and so on...) I'm using driver.find_elements_by_xpath (all of the sub-links can be found by combination of class & div) and looping if i have more than one link (technically a nested for loop for each child) . Can this be optimized into a function, like a recursive Depth first search? Below is the code snippet which i tried. def iterate_child_links(): elements = driver.find_elements

How to use browsermob with python-selenium behind a corporate proxy?

感情迁移 提交于 2021-02-08 09:37:06
问题 My test environment is under a corporate proxy (" proxy.ptbc.std.com:2538 ").I want to open a particular video on YoTube for a period of time (eg 200 seconds) and capture the har file for each visit, the process is repeated several times for a massive test. I have tried different examples found here but the firefox / chrome browsers do not connect to the internet because they are behind the proxy. How can run "python-selenium + browsermobproxy" behind a corporate proxy and capture the har

What does xpath=“1” mean in HTML?

浪子不回头ぞ 提交于 2021-02-08 08:52:47
问题 In my design code, the following is written. I cannot understand what xpath="1" means here. <select class="search-category" id="ddlTemp" name="Template" xpath="1"> <option value="">Select</option> <option value="a">a</option> <option value="b">b</option> </select> 回答1: In General There is no standard interpretation of xpath="1" in HTML because there is no standard xpath attribute on a select element (or any other HTML element). You've stumbled across some application's idiosyncratic markup;

How can I add an extension to my chromedriver at the Robot Framework with Selenium2Library and launch remotely

醉酒当歌 提交于 2021-02-08 08:26:48
问题 I got stuck with scenario like How can I add an extension to my chromedriver at the Robot level with Selenium2Library , but i am trying to launch browser on a remote machine. Answer present on the above question works well on local machine. But to how to add an extension to chrome browser and launch on remote machine. Using python to get chrome options def launchbrowserwithextension(): options = webdriver.ChromeOptions() options.add_argument('--load-and-launch-app=path_to_extension') return

How can I add an extension to my chromedriver at the Robot Framework with Selenium2Library and launch remotely

流过昼夜 提交于 2021-02-08 08:26:23
问题 I got stuck with scenario like How can I add an extension to my chromedriver at the Robot level with Selenium2Library , but i am trying to launch browser on a remote machine. Answer present on the above question works well on local machine. But to how to add an extension to chrome browser and launch on remote machine. Using python to get chrome options def launchbrowserwithextension(): options = webdriver.ChromeOptions() options.add_argument('--load-and-launch-app=path_to_extension') return

TestNG - Order of Tests execution in selenium script

寵の児 提交于 2021-02-08 08:22:20
问题 I'm using selenium 3.8.1 and TestNG 6.9.2 version,while test execution before completing the @Test method another @Test method is starts,because of this i'm getting error in selenium script After completion of Test Cases execution. One Class public class LoginPage{ @Test(priority=0) public void test1(){ System.out.println(first test); } @Test(priority=1) public void test2(){ System.out.println(Second test); } } Second Class public class HomePage{ @Test(priority=0) public void test3(){ System

TestNG - Order of Tests execution in selenium script

亡梦爱人 提交于 2021-02-08 08:21:42
问题 I'm using selenium 3.8.1 and TestNG 6.9.2 version,while test execution before completing the @Test method another @Test method is starts,because of this i'm getting error in selenium script After completion of Test Cases execution. One Class public class LoginPage{ @Test(priority=0) public void test1(){ System.out.println(first test); } @Test(priority=1) public void test2(){ System.out.println(Second test); } } Second Class public class HomePage{ @Test(priority=0) public void test3(){ System