selenium

Excel VBA using Selenium

时间秒杀一切 提交于 2021-02-18 19:13:45
问题 I am om Windows 10. I am trying to use Selenium to automate the Edge browser (or any other browser) via Excel VBA. I went to https://www.selenium.dev/downloads/ There I downloaded Selenium Server, Latest stable version 3.141.59 and Python 3.141.0 November 01, 2018 4.0.0a6.post1 May 28, 2020 Download (I am not using Python but I thought I might in the future.) Then I opened Excel VBA and opened Tools but could not find the “Selenium Type Library” option in the drop down. I did more reading and

How do I disable WebRTC in Chrome Driver?

自闭症网瘾萝莉.ら 提交于 2021-02-18 18:53:57
问题 I want to disable WebRTC in Chrome Driver, but can't figure out how to do it. I tried like this (found this solution in some blog): capabilities.setCapability("chrome.switches", Arrays.asList( "--disable-webrtc-multiple-routes", "--disable-webrtc-hw-encoding", "--disable-webrtc-hw-decoding", "--disable-webrtc-encryption")); It doesn't work. Yes, I know there isn't something like "--disable-webrtc" there, but it's all I have found about WebRTC, I mean, I didn't find some other WebRTC

Uploading all files in a folder with windows file upload - Selenium

假装没事ソ 提交于 2021-02-18 18:51:03
问题 I am uploading files to a website using Selenium 2. I can upload one file by specifying the upload path, but I want to upload all files within a folder. Here's my code: if (driver.findElements(By.xpath("//input[@type='file']")).size() > 0) { driver.findElement(By.xpath("//input[@type='file']")).sendKeys("C:\\Users\\Bernard\\Dropbox\\Demo Submission\\Submissions\\Cooley - Imagination Land EP\\Cooley - Imagination Land.mp3"); } "Cooley - Imagination Land EP" is the folder that contains all the

RSelenium: Scraping a dynamically loaded page that loads slowly

蹲街弑〆低调 提交于 2021-02-18 18:39:50
问题 I'm not sure if it is because my internet is slow, but I'm trying to scrape a website that loads information as you scroll down the page. I'm executing a script that goes to the end of the page, and waits for the Selenium/Chrome server to load the additional content. The server does update and load the new content, because I am able to scrape information that wasn't on the page originally and the new content shows up on the chrome viewer, but it only updates once. I set a Sys.sleep() function

detecting a file downloaded in selenium java

南笙酒味 提交于 2021-02-18 12:09:23
问题 I wrote an automation test in selenium java that detects if the page is redirecting (the automation detects if a new page is opened, the page redirects to other page, a new tab is opened and if an alert window is opened) Now to the problem. one of the redirects i can't find any way to detect is an automatic downloaded file (you enter a website and the website automatically downloads a file without any trigger from the user) p.s. I know the download process may differ in each browser, I need

detecting a file downloaded in selenium java

寵の児 提交于 2021-02-18 12:07:43
问题 I wrote an automation test in selenium java that detects if the page is redirecting (the automation detects if a new page is opened, the page redirects to other page, a new tab is opened and if an alert window is opened) Now to the problem. one of the redirects i can't find any way to detect is an automatic downloaded file (you enter a website and the website automatically downloads a file without any trigger from the user) p.s. I know the download process may differ in each browser, I need

Specifying multiple conditions in xpath

旧时模样 提交于 2021-02-18 11:42:05
问题 I want to select all the tags with <td class='blob-code blob-code-addition'> and <td class='blob-code blob-code-deletion'> . So I am trying to include or condition here between the two predicates. It does not work. However, if I include only one of the two classes it works . What is the problem here? Something is wrong with the syntax. By getChanges = By.xpath("//td[@class='blob-code blob-code-addition'] or //td[@class='blob-code blob-code-deletion']"); 回答1: You want to specify that like the

Selenium - Find all elements of a web page

倾然丶 夕夏残阳落幕 提交于 2021-02-18 09:32:18
问题 I am planning a tool in Java which would have a drop down containing all the elements of a web page. Is there any way I can read those into a data structure? 回答1: Yes, there is a way. Here is some pseudo-code: List<WebElement> el = driver.findElements(By.cssSelector("*")); for ( WebElement e : el ) { add(e.tagName()); } 回答2: non-pseudo C# version of above: (although I'm just displaying the results in a console IReadOnlyCollection el = driver.FindElements(By.CssSelector("*")); foreach

Selenium - Find all elements of a web page

自古美人都是妖i 提交于 2021-02-18 09:31:13
问题 I am planning a tool in Java which would have a drop down containing all the elements of a web page. Is there any way I can read those into a data structure? 回答1: Yes, there is a way. Here is some pseudo-code: List<WebElement> el = driver.findElements(By.cssSelector("*")); for ( WebElement e : el ) { add(e.tagName()); } 回答2: non-pseudo C# version of above: (although I'm just displaying the results in a console IReadOnlyCollection el = driver.FindElements(By.CssSelector("*")); foreach

How to find element that has multiple class in selenium

不羁的心 提交于 2021-02-18 08:05:25
问题 I have an element with 3 classes which I need to find with selenium <button style="padding:2px 7px; background-color:#4caeea" class="btn btn-xs btn-custom" </button> I could not find it with : By.classname("btn btn-xs btn-custom") I do not want to use xpath & cssSelector . What other options do I have ? 回答1: This By.classname("btn btn-xs btn-custom") will not work, as it contains multiple spaces which means it is combination of 3 classes. You will have to switch to css selector or xpath , I