我有一个用Ruby编写的刮擦脚本,它使用Selenium、Watir和ChromeDriver,所有这些都可以在Chrome浏览器窗口中正常工作,但是尝试在无头模式下运行只需点击;
Selenium::WebDriver::Error::UnknownError: unknown error: Element <input id="desired_element" type="checkbox" name="desired_element" checked="checked"> is not clickable at
使用Chrome浏览器时,调用send_key函数时Selenium::WebDriver::Error::ElementNotVisibleError:元素不可见。
Selenium::WebDriver::Error::ElementNotVisibleError: element not visible
我并行运行ruby selenium脚本,在通过send_key将文本输入发送到网页时遇到以下问题。
Im using following versions:
(Session info: chrome=43.0.2357.125)
(Driver info: chromedriver=
我正在为一个著名的电子商务网页的刮刮项目工作。我希望浏览器不要显示,解决问题的方法是使用“--无头”选项,但是要刮掉的页面不允许“无头”。我也试过“有没有人有其他的解决方案?
这里我的代码:
import random
from django.shortcuts import render
from bs4 import BeautifulSoup
from selenium import webdriver
#Selenium 4 with Chrome
from selenium.webdriver.chrome.service impor
我正在尝试使用selenium webdriver登录gmail。
以下代码在没有headless选项的情况下工作,我可以成功登录:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
options = webdriver.ChromeOptions()
我想从网站- 中提取CSV下载网址
我以前用过的代码
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdr
我想在这个页面上使用Selenium:
如果没有无头模式,那么所有代码都可以正常工作:
import requests
from bs4 import BeautifulSoup
import os, sys, time
import xlwings as xw
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from random import
我刚开始学习Selenium,需要使用云中没有GUI的jenkins机器来验证登录网页。我设法在我的具有UI的系统上成功地运行了脚本。但是,当我将脚本修改为无头运行时,它无法显示unable to locate element。我的脚本如下:
#!/usr/bin/env python3
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from webdrive
我想让Selenium在后台工作。
DRIVER=webdriver.Chrome('/Applications/chromedriver')
driver.minimize_window()
但是,我不能使用以下代码:
ActionChains(DRIVER).move_by_offset(10,10).click().perform() # Clicks on a specific area, I can't work with xpath here.
有人能帮我吗?
嘿精彩的Stack溢出社区,
在处理警报方面,我遇到了一个有趣的场景,比如弹出用户身份验证框。
1:使用的网站(实践网站):
2:当我点击Basic Auth时,出现了一个类似弹出窗口的警报(见下文)。
他说:到目前为止,我已经尝试过了。
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDri
在我真正完成我的第一个机器人之前,我只有一个障碍要克服,那就是弄清楚在哪里放置选项类(?)为了在无头模式下运行ChromeDriverManager,所以它停止打开chrome实例!调用司机的方式是:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from webdriver_manager.chrome import ChromeDriverManager
我想让selenium运行一个google chrome的无头实例,从某些网站挖掘数据,而不需要UI开销。我从下载了chromedriver可执行文件,并将其复制到我当前的脚本目录中。驱动程序似乎可以很好地使用selenium,并且能够自动浏览,但是我似乎找不到headless选项。大多数使用selenium和无头铬的在线示例都是这样的:
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.opt
我目前正在尝试访问一个网页,该网页使用Imperva/Incapsula作为他们的CDN。我的selenium浏览器被屏蔽了,他们可以以某种方式检测到我正在使用selenium。它在Chrome/Firefox的相同IP上工作得很好。它只在硒中被阻断。
显示硒被阻挡
显示它在正常的Chrome 中工作
我已经尝试了一些基本的方法,比如欺骗用户代理。他们正在运行一些模糊的JS脚本来检测一些我不知道的东西。
当前代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.w
我在试着刮Amazon product prices。我想在不打开Chrome浏览器的情况下刮掉价格文本。我在网上查了这个,但没帮上忙。
这是我的密码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
# Driver and link
driver = webdriver.Chrome('C:/Users/musta/Desktop/chromedriver.exe')
driver.get("https://www.amazon.com/dp/b07h9f
除了前面的问题无法在使用selenium的j测量仪中使用铬驱动程序无头模式执行测试计划之外,我还添加了150秒的显式等待,并使用J抄GUI在Chrome驱动程序的无头模式下运行测试计划,它再次给出了一个错误:
2020-04-30 13:16:33,916 ERROR c.g.j.p.w.s.WebDriverSampler: Expected condition failed: waiting for element to be clickable: By.id: userDropdown (tried for 150 second(s) with 500 milliseconds inte