selenium-webdriver

Selenium how to upload files to Microsoft Edge

纵饮孤独 提交于 2020-04-16 03:54:46
问题 I am using the following code to upload files to a website to a 'file' type element. The code works fine in Firefox, Chrome and Safari. However when I run the code against Edge the file is NOT uploaded driver.setFileDetector(new LocalFileDetector()); selectFile.sendKeys(path); This error is reported: The command failed because the specified element is not pointer or keyboard interactable. If I try using Javascript like this: document.getElementById('manual_file_selection').sendKeys(path) I

Selenium how to upload files to Microsoft Edge

僤鯓⒐⒋嵵緔 提交于 2020-04-16 03:52:59
问题 I am using the following code to upload files to a website to a 'file' type element. The code works fine in Firefox, Chrome and Safari. However when I run the code against Edge the file is NOT uploaded driver.setFileDetector(new LocalFileDetector()); selectFile.sendKeys(path); This error is reported: The command failed because the specified element is not pointer or keyboard interactable. If I try using Javascript like this: document.getElementById('manual_file_selection').sendKeys(path) I

selenium.common.exceptions.InvalidArgumentException: Message: invalid argument error invoking get() with urls read from text file with Selenium Python

偶尔善良 提交于 2020-04-14 19:22:08
问题 I have a list of URLs in a .txt file that I would like to run using selenium. Lets say that the file name is b.txt in it contains 2 urls (precisely formatted as below): https://www.google.com/,https://www.bing.com/, What I am trying to do is to make selenium run both urls (from the .txt file), however it seems that every time the code reaches the "driver.get" line, the code fails. url = open ('b.txt','r') url_rpt = url.read().split(",") options = Options() options.add_argument('--headless')

Is it possible to set chrome webdriver file as URL?

馋奶兔 提交于 2020-04-14 09:11:32
问题 I have this code to set system properties: System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\driver\\chromedriver.exe"); Is it possible to store chromedriver executable within GitHub and use it in different projects? Something like this: System.setProperty("webdriver.chrome.driver", "https://path_to_file/chromedriver.exe"); 回答1: The open source WebDriverManager may be the closest solution to what you are asking for. WebDriverManager.chromedriver().setup(); WebDriver driver

Is it possible to set chrome webdriver file as URL?

我只是一个虾纸丫 提交于 2020-04-14 09:10:07
问题 I have this code to set system properties: System.setProperty("webdriver.chrome.driver", "src\\main\\resources\\driver\\chromedriver.exe"); Is it possible to store chromedriver executable within GitHub and use it in different projects? Something like this: System.setProperty("webdriver.chrome.driver", "https://path_to_file/chromedriver.exe"); 回答1: The open source WebDriverManager may be the closest solution to what you are asking for. WebDriverManager.chromedriver().setup(); WebDriver driver

ModuleNotFoundError: No module named 'selenium'

女生的网名这么多〃 提交于 2020-04-14 06:26:51
问题 I get an error while running this selenium script. Please suggest what can be done to fix this: Script: from selenium import webdriver from selenium.webdriver.common.keys import Keys import re import csv import time driver = webdriver.chrome("<webdriver path>") driver.get("https://www.google.com/") driver.find_element_by_xpath('//*[@title="Search"]') send_keys('abc') driver.find_element_by_xpath('//*[@class="sbico _wtf _Qtf"]').click() time.sleep(5) driver.find_element_by_xpath('//[@id="rso"]

selenium.common.exceptions.WebDriverException: Message: Service

喜你入骨 提交于 2020-04-13 07:50:35
问题 I had a trouble when i use selenium to control my Chrome. Here is my code: from selenium import webdriver driver = webdriver.Chrome() When i tried to operate it ,it runs successfully at first,the Chrome pop on the screen. However, it shut down at the few seconds. Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> driver = webdriver.Chrome('C:\Program Files (x86)\Google\Chrome\chrome.exe') File "C:\Users\35273\AppData\Local\Programs\Python\Python35\lib\site-packages

How to press Ctrl+V in Selenium WebDriver

无人久伴 提交于 2020-04-13 06:20:30
问题 In one of my automated tests I need to press Ctrl + V in text box to paste text in it. But I can't do that. I'm using Selenium WebDriver for .net v. 2.35.0.0. Here is my code, it does not work. It presses Ctrl and then V , but text not gets pasted in the box: IWebDriver webDriver = new InternetExplorerDriver(); webDriver.Navigate().GoToUrl(@"C:\Users\us\Documents\Visual Studio 2012\Projects\SeleniumTests\SeleniumTests\test.html"); var el = webDriver.FindElement(By.XPath(".//*[@id='fld']"));

Selenium how to Enter data in to tabular format frame - in horizontal way in UI

半城伤御伤魂 提交于 2020-04-12 07:31:06
问题 My List> Has below Data : [{Test_Case_id=tc1, Delimiter=|,SourceFile=/tmp/tes.dat,targetFile=/tmp/tgt.file}, {Test_Case_id=tc2, Delimiter=;,SourceFile=/tmp/tes1.dat,targetFile=/tmp/tgt1.file}, {Test_Case_id=tc3, Delimiter=|,SourceFile=/tmp/tes2.dat,targetFile=/tmp/tgt2.file}] In UI page, I have to enter these values in the table. the table looks like below //<Header> Test_Case_id Delimiter SourceFile TargetFile <Input Box> <Input Box> <Input Box> <Input Box> <Input Box> <Input Box> <Input Box

Selenium how to Enter data in to tabular format frame - in horizontal way in UI

廉价感情. 提交于 2020-04-12 07:31:01
问题 My List> Has below Data : [{Test_Case_id=tc1, Delimiter=|,SourceFile=/tmp/tes.dat,targetFile=/tmp/tgt.file}, {Test_Case_id=tc2, Delimiter=;,SourceFile=/tmp/tes1.dat,targetFile=/tmp/tgt1.file}, {Test_Case_id=tc3, Delimiter=|,SourceFile=/tmp/tes2.dat,targetFile=/tmp/tgt2.file}] In UI page, I have to enter these values in the table. the table looks like below //<Header> Test_Case_id Delimiter SourceFile TargetFile <Input Box> <Input Box> <Input Box> <Input Box> <Input Box> <Input Box> <Input Box