selenium

Reading data from excel in selenium C#

爷,独闯天下 提交于 2021-02-08 11:15:38
问题 I'm trying to read username and password from excel sheet while using Selenium in C# .NET. Below is the code: using excel = Microsoft.Office.Interop.Excel; public void TestMethod1() { excel.Application xlApp = new excel.Application(); excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:\Test\TestData.xlsx"); excel._Worksheet xlWorksheet = **xlWorkbook.Sheets[1];** excel.Range xlRange = xlWorksheet.UsedRange; } I'm getting the following error at the text that is marked in bold in above code:

Design issue in Cucumber spring WebDriver quit in @After method

让人想犯罪 __ 提交于 2021-02-08 11:05:30
问题 I have a design issue when I am trying to build a framework using cucumber, selenium and cucumber-spring. My expected behavior is to quit WebdDriver instance for every scenario. But Here is my page objects in src\main\java @Component public class BasePage { WebDriver driver; public BasePage(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this); } public WebDriver getDriver() { return this.driver; } } Here is another page object class which extends the Base class.

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 to start Chrome (both normal & incognito modes) and open URL in remote PC (node) using Selenium Grid in Java?

一曲冷凌霜 提交于 2021-02-08 10:40:17
问题 I am trying Selenium Grid in Java and just want to start Chrome in both normal mode and incognito mode in remote PC (node) and open google.com I have setup the hub - node connection. I tried this code, but it seems to be wrong. Any guidance how to do that? How to use capability.setCapability() ? I found some example to start IE and just replaced the word InternetExplorer with Chrome ... Doesn't work. Thanks. Not working code: System.setProperty("webdriver.chrome.driver" , "C:/Users

How to install the Selenium IDE(selenium-ide-2.9.0.xpi) in Firefox 45.0?

时间秒杀一切 提交于 2021-02-08 10:25:57
问题 Unable to install the Selenium IDE (selenium-ide-2.9.0.xpi), after hitting the allow button, it begins the downloading part and even after completing the downloading the Install button is disabled. [ ] 回答1: I solved this by installing legacy version of Firefox. You have to uninstall the current one then download the old version from https://ftp.mozilla.org/pub/firefox/releases/41.0/win32/en-US/. 回答2: Record and play tests are very hard to maintain. Please consider developing a test automation

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

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 swith to iframe inside shadow dom with selenium

此生再无相见时 提交于 2021-02-08 09:53:39
问题 Application under test is based on Electron (version 9.1.1) written as desktop application for Linux. In electron there are custom tag <webview> that is quote "The webview tag is essentially a custom element using shadow DOM to wrap an iframe element inside it." I can access shadow dom and get iframe as WebElement out of it with Java selenim(version 3.141.59). But swithcing to iframe still left me on parent context. And my question is: HOW TO SWITH TO IFRAME INSIDE SHADOW DOM? //getting

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

How to launch chrome browser from Jenkins directly instead of using code in eclipse

痴心易碎 提交于 2021-02-08 09:22:38
问题 I have created a maven project for Web automation tests I am using code below to launch browser System.setProperty("webdriver.chrome.driver", "pathChromeDriver"); driver = new ChromeDriver(); driver.manage().window().maximize(); Also I am using Jenkins to execute my test suite and it's working fine. Now I want to configure browser launch operation from Jenkins without using it in my maven project. Can we do this using plugins available in Jenkins ??? If yes then please help me with that. 回答1: