selenium

How to hide the warning “This type of file can harm your computer” while downloading .xml file using Chrome Chromedriver 79 with Selenium Java

拈花ヽ惹草 提交于 2021-02-05 06:38:06
问题 Despite setting safebrowsing.enabled to true / false , the warning ...This type of file can harm your computer... is still being displayed in browser. How to hide this information? 回答1: To enable downloading of file using Chrome/ChromeDriver hiding the warning This type of file can harm your computer you need to: Add the preferences: download.default_directory download.prompt_for_download download.extensions_to_open safebrowsing.enabled As well as add the following arguments to whilelist: -

Selenium Chrome driver - SyntaxError: (unicode error) 'unicodeescape' codec

≯℡__Kan透↙ 提交于 2021-02-05 06:35:27
问题 I am trying to type my first GUI test in pycharm with selenium. I installed selenium by cmd raport: C:>pip install selenium Requirement already satisfied: selenium in c:\users\admin\appdata\local\programs\python\python37-32\lib\site-packages (3.141.0) Requirement already satisfied: urllib3 in c:\users\admin\appdata\local\programs\python\python37-32\lib\site-packages (from selenium) (1.24.1) Then I wrote some code in pycharm: from selenium import webdriver import time driver = webdriver.Chrome

How to locate/find element whose ID and xpath changes on every refresh - Selenium WebDriver Java

一曲冷凌霜 提交于 2021-02-05 06:33:05
问题 I am working on selenium webdriver using java, and I am facing a problem. I have a field on a page whose id and xpath changes every time that page is loaded. Like, when I open that page manually, I can see some id and xpath, but when my test run, the id, xpath has changed. Example, .//*[@id='dp1445259656810'] .//*[@id='dp1445260051638'] .//*[@id='dp1445260078674'] .//*[@id='dp1445260154173'] these are the xpaths that are created every time I refresh my page. How can I locate/find such an

selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 85

一笑奈何 提交于 2021-02-05 06:31:07
问题 Hey so I have this simple code to open google using selenium from selenium import webdriver import chromedriver_binary driver = webdriver.Chrome() driver.get('https://google.com') Instead of opening the google page I get this error. Traceback (most recent call last): File "main.py", line 5, in <module> driver = webdriver.Chrome() File "C:\Users\vipku\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in __init__ RemoteWebDriver.__init

Selenium in Java stops working with java.lang.IllegalAccessError:from class org.openqa.selenium.net.UrlChecker when ZXing dependency is added

非 Y 不嫁゛ 提交于 2021-02-05 05:29:08
问题 So, I'm building a test project on java using Selenium, with gradle. Right now I need to scan a QR Code from a previously taken screenshot. I looked around how to do it, and the ZXing scanner code seems like the best suggestion. (Please let me know if it isn't.) My problem is, from the moment I add the 'com.google.zxing:zxingorg:3.3.1' dependency to my build.gradle file, even if I don't write any additional code with it (I've tried with and without), the web driver stops working, and I get

Selenium in Java stops working with java.lang.IllegalAccessError:from class org.openqa.selenium.net.UrlChecker when ZXing dependency is added

可紊 提交于 2021-02-05 05:28:26
问题 So, I'm building a test project on java using Selenium, with gradle. Right now I need to scan a QR Code from a previously taken screenshot. I looked around how to do it, and the ZXing scanner code seems like the best suggestion. (Please let me know if it isn't.) My problem is, from the moment I add the 'com.google.zxing:zxingorg:3.3.1' dependency to my build.gradle file, even if I don't write any additional code with it (I've tried with and without), the web driver stops working, and I get

“java.lang.module.InvalidModuleDescriptorException: Provider class org.apache.bsf.BSFManager not in module” error with ChromeDriver Selenium

浪尽此生 提交于 2021-02-04 21:00:42
问题 I am using eclipse 09-2019 with jdk13 and selenium 3.0.1 .jar file. My Code is: package package1; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class Script1 { public static void main(String[] args) { System.out.println("Hii"); System.setProperty("Webdriver.chrome.driver","E:\\Selenium\\chromedriver.exe"); WebDriver driver=new ChromeDriver(); driver.get("http://www.google.com"); } } Error: java

How to extract all href from a class in Python Selenium?

自作多情 提交于 2021-02-04 20:48:09
问题 I am trying to extract people's href from the URL https://www.dx3canada.com/agenda/speakers. I tried: elems = driver.find_elements_by_css_selector('.display-flex card vancouver') href_output = [] for ele in elems: href_output.append(ele.get_attribute("href")) print(href_output) But the output list returns nothing... The expected href shown as the image below and I hope the outputs as a list of hrefs: I really appreciate the help! 回答1: To extract the people's href attribute from the URL https:

Scraping dynamic content through Selenium?

你说的曾经没有我的故事 提交于 2021-02-04 19:46:25
问题 I'm trying to scrap dynamic content from a Blog through Selenium but it always returns un rendered JavaScript. To test this behavior I tried to wait till iframe loads completely and printed it's content which prints fine but again when I move back to parent frame it just displays un rendered JavaScript. I'm looking for something in which I'm able to print completely rendered HTML content from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium

Python and Selenium mobile emulation

孤者浪人 提交于 2021-02-04 19:08:50
问题 I'm trying to emulate Chrome for iPhone X with Selenium emulation and Python, as follow: from selenium import webdriver mobile_emulation = { "deviceName": "iphone X" } chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) driver = webdriver.Chrome(r'C:\Users\Alex\PythonDev\chromedriver') driver.get('https://www.google.com') However, nothing happens: my page is still a normal browser page, and I don't see it as a mobile page.