selenium

Downloading PDF using Selenium Java not working in Chrome

随声附和 提交于 2021-01-29 05:41:35
问题 I have written the following code to disable the Chrome PDF viewer so that the PDF file can be downloaded automatically in the C:\downloads folder when the link is opened in Chrome. ChromeOptions options = new ChromeOptions(); Map<String, Object> prefs = new HashMap<>(); prefs.put("download.default_directory", "C:\\downloads"); prefs.put("download.prompt_for_download", false); prefs.put("plugins.always_open_pdf_externally", true); options.setExperimentalOption("prefs", prefs); options

java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;

拟墨画扇 提交于 2021-01-29 05:30:28
问题 When I try to create a RemoteWebDriver in 3.11, I see this error below. This worked fine up through 3.10. I've reverted to 3.10 for now. I tried adding in the gson jar from google, but I still see same error. Anyone else see this? I'm running one selenium server as hub, and then running a node against it with webdriver for ff or chrome, same issue. com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom

How to click a link by text with No Text in Python

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-29 05:30:27
问题 I am trying to scrape a Wine data from vivino.com and using selenium to automate it and scrape as many data as possible. My code looks like this: import time from selenium import webdriver browser = webdriver.Chrome('C:\Program Files (x86)\chromedriver.exe') browser.get('https://www.vivino.com/explore?e=eJwFwbEOQDAUBdC_uaNoMN7NZhQLEXmqmiZaUk3x987xkVXRwLtAVcLLy7qE_tiN0Bz6FhcV7M4s0ZkkB86VUZIL9l4kmyjW4ORmbo0nTTPVDxlkGvg%3D&cart_item_source=nav-explore') # Vivino Website with 5 wines for now

How to retrieve data from the popup after clickable element trigger with WebDriverWait in Selenium Python?

不羁岁月 提交于 2021-01-29 05:20:53
问题 I need to scrape the image src from this popup. I have coded that but getting "AttributeError: 'NoneType' object has no attribute 'findElements'. Here is the code. from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.chrome.options import Options from chromedriver_py import binary_path import time from time import sleep url =

Loading Selenium user profile in Tor Chrome on Windows

浪尽此生 提交于 2021-01-29 04:54:42
问题 This code works for Windows where it launches Chrome connected via Tor. Keep in mind you have to have Tor browser running beforehand . How can I enable the user-profile and start the browser logged in? I have tried the regular method. I have only 1 profile. Default. Doesn't seem to be working. Any clues? import time from selenium import webdriver from selenium.webdriver.chrome.options import Options tor_proxy = "127.0.0.1:9150" chrome_options = Options() '''chrome_options.add_argument("--test

Loading Selenium user profile in Tor Chrome on Windows

六眼飞鱼酱① 提交于 2021-01-29 04:53:04
问题 This code works for Windows where it launches Chrome connected via Tor. Keep in mind you have to have Tor browser running beforehand . How can I enable the user-profile and start the browser logged in? I have tried the regular method. I have only 1 profile. Default. Doesn't seem to be working. Any clues? import time from selenium import webdriver from selenium.webdriver.chrome.options import Options tor_proxy = "127.0.0.1:9150" chrome_options = Options() '''chrome_options.add_argument("--test

How to navigate to new browser window using partial title text using either Python, or JavaScript or Robot Framework and Selenium

故事扮演 提交于 2021-01-29 04:52:52
问题 During my tests, we need to click on links that open webpages in new tab. In some cases, we see the test fail due to inclusion of multiple space or tab characters in the title text. One of the examples of such titles are - "Looking for more information about US?${SPACE}${SPACE}Find out more from ... Get your questions answered." I am trying to switch to the window using the partial text "Looking for more information about US" instead of using the whole title text. But so far could not find a

How to navigate to new browser window using partial title text using either Python, or JavaScript or Robot Framework and Selenium

人盡茶涼 提交于 2021-01-29 04:51:17
问题 During my tests, we need to click on links that open webpages in new tab. In some cases, we see the test fail due to inclusion of multiple space or tab characters in the title text. One of the examples of such titles are - "Looking for more information about US?${SPACE}${SPACE}Find out more from ... Get your questions answered." I am trying to switch to the window using the partial text "Looking for more information about US" instead of using the whole title text. But so far could not find a

UnexpectedTagNameException: Message: Select only works on <select> elements, not on <li>error selecting li element from a Dropdown using Selenium

狂风中的少年 提交于 2021-01-29 04:49:59
问题 I wish to click on New Test. The HTML code looks something like this. I'm new here and beginning to learn automation using selenium-python. <li id="testing"> <ul class="dd"> <li><a href="javascript:toolsPopup('/abc/xyz/text.html');"><span>New Test</span></a></li> <li><a href="javascript:toolsPopup('/abc/xyz/list.html');"><span>Test List</span></a></li> </ul> </li> The code that I'm trying to use element=driver.find_element_by_id('testing') drp=Select(element) drp.select_by_visible_text('New

Selenium + Node.js: is it possible to listen for reoccurring events?

时间秒杀一切 提交于 2021-01-29 04:49:11
问题 I am working on a site that is heavily powered by AJAX/REST API calls, which broadcast events on completion/failure. What I am trying to accomplish is to listen for these document events and trigger a function in Selenium (Node.js) -- right now I'm settling for a console.log() -- and keep that listener running to report any new occurrences of the "customEvent" My latest implementation looks like this: driver = await new Builder().forBrowser('chrome').build(); await driver.get('http://www