我正在使用Selenium和Chrome驱动程序,但我还没能通过ID找到一个元素。但是,这个元素在浏览器的web检查器中是可见的。我认为这是因为元素是动态生成的(我总是在浏览器的URL栏中看到相同的Url,但内容是动态变化的。
解决这个问题的方法是正确理解和驱动程序等待。第一个页面是登录页面,我可以成功地跳过该页面:
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_condi
我希望使用一个无头浏览器来刮一些网站,并需要使用代理服务器。
我有点迷路了,正在找人帮忙。
当我禁用代理时,它每次都能完美地工作。
当我禁用无头模式时,我会得到一个空的浏览器窗口,但是如果我在具有"“的地址栏上按enter键,就会加载页面(使用显示不同IP的代理服务器)。
对于其他网站,我也有同样的错误,不仅仅是whatsmyip.org有这样的结果。
我正在运行Centos7、Python3.6和Selenium 3.14.0。
我还在运行Anaconda的Windows机器上试用了它,并得到了相同的结果。
from selenium import webdriver
from se
from selenium import webdriver
driver = webdriver.Chrome(executable_path=r'/usr/local/bin/google-chrome')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()
我收到这个错误:
File "test.py", line 5, in <module>
driver = w
我想使用Selenium在Chrome中完成一些简单的任务,然后将代码导出到python并在那里执行。但是,当我在python中执行导出的代码时,什么都不会发生。
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from seleniu
我正在使用selenium和python自动化一个过程。但是我被一些东西卡住了。我必须点击一个使用selenium的链接。这个链接是href,每次都会动态生成。href链接将类似于3。对于另一个页面,它将是66
现在,为了模拟这个链接的点击,有什么方法可以点击它吗?如何获取动态生成的链接?我正在为selenium webdriver使用python代码。
尝试“self.driver.find_element(By.CSS_SELECTOR, "create_job_listing_ajax > div:nth-child(4) > div > div > di
我是Python和Selenium的新手,正在尝试获取特定页面的截图,并在文件名中显示截图时间,以下是代码片段:
from selenium import webdriver
import time
from time import gmtime, strftime
browser = webdriver.Chrome()
browser.get('https://google.com')
time.sleep(3)
browser.get_screenshot_as_file('C:\\path\\screenshots\\(strftime("%Y-%m-%
尝试通过python中的selenium Chrome驱动程序从chrome打开"“或任何其他页面(网站)。
代码是:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
import time
driver =
使用python和Selenium,我无法刮掉在JavaScript网站上找到的任何插入的数据。我已经用动态生成的内容在其他网站上测试了我的代码,所以我想知道这是否是在这个站点上生成JS的特定方式?
我希望在这个项目的网站上找到库存。下面的代码生成以下异常:selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[@id=
from selenium import webdriver
def driverInit(url):
global driver
# webdriver init
driver = webdriver.Chrome()
driver.get(url) # address
sleep(2) # time for page load
link = input("enter a url")
driverInit(link) 这是我访问网页的代码。应该能行得通。它几乎适用于我给它的所有链接,除了一个链接。当我将这个链接输入到浏览器中时,
我试图计算从点击“加载更多的评论”选项的次数。但我得到了以下错误:
selenium.common.exceptions.StaleElementReferenceException:消息:陈旧的元素引用:元素没有附加到页面文档
下面是我的python代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support imp
我有一个用ajax加载动态内容的页面,然后在一段时间后重定向(不是固定的)。如何强制Selenium Webdriver等待页面重定向,然后立即转到不同的链接?
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support import expected_conditions as EC
from sele
首先,对不起我的英语,其次,我只有两周大的巨蟒。
现在我使用python、模块selenium和chromedriver,我要刮的页面是",我使用的代码如下:
from time import sleep
from selenium import webdriver
from bs4 import BeautifulSoup as bs
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("disable-ext
我正在尝试使用python和selenium来刮。
我刚开始就注意到他们使用DataDome进行机器人检测,所以我必须传递一个captcha,但是在尝试自动化其中任何一个(这个问题与此无关)之前,我只是在selenium打开的铬浏览器上手工解决了Captcha问题,它没有工作,只要我解决了它,它就会回到captcha,我无法访问这个站点,它被困在一个循环中。
这是我的密码:
import time
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from seleniu
我正在尝试使用python和selenium相结合的方式从网页中获取所有标题,因为内容是非常动态的。然而,当我运行我的脚本时,它只是获取其中的前几个。我在脚本中定义的选择器似乎完美无缺。
我怎样才能从那一页中得到所有的标题?
我试过:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_co