我正在尝试开发一个使用python的刮刀,它将在Chrome的多个选项卡中打开网页中的链接。
我拼凑的代码是
import urllib2
from datetime import timedelta, date
import selenium.webdriver as webdriver
import selenium.webdriver.support.ui as ui
import time
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
i = driver.get("
我有一个python脚本,它使用selenium来做一些网页点击和抓取。脚本在ubuntu上,在EC2实例上运行。基本代码:
from selenium import webdriver
from bs4 import BeautifulSoup as bs
import datetime
from datetime import datetime as dt
import re
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import ElementNotVisib
我已经使用Selenium编写了一个脚本,它在浏览器模式下工作。然而,当我在Headless模式下尝试它时,它不再工作。我已经添加了一些参数来将窗口大小更改为我的屏幕分辨率;但是这仍然不能解决问题。奇怪的是有些按钮能用,但有些却不行。我不太清楚发生了什么。 from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options
import time
user_input='xyz'
我正在尝试使用selenium、chromedriver和python登录到一个页面()。但是,尽管这个元素很容易找到,但我还是想不出一种与它交互的方法。
我正在用python3.7、chromedriver和windows 10运行它,不要认为这可能是问题所在。似乎有一些元素覆盖了我试图输入的数据,但是无法理解什么。
这是我用来做的代码。
**def login(username, senha):
#entra no site e faz login
driver.get('https://www.aprovaconcursos.com.br/questoes-d
我一直在使用Selenium (Python Webdriver)抓取一个网站。当我尝试让它拒绝一个选项时,我得到了一个click()错误。完整堆栈跟踪:
Traceback (most recent call last):
File "scrape.py", line 19, in <module>
subjectOptions[1].click()
File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webelement.py", line 45, i
因此,我的代码试图通过一个链接列表(所有这些链接的可见文本都是“年度”),然后,当在新的网页上,在下拉列表中迭代大约20年的年份,并下载每年的数据集。所以有两个循环。我的代码被困在了年份循环中-也就是说,对于相同的“年度”,它在2年后会得到一个陈旧的元素错误。
我正在研究chrome,这是我代码的相关部分:
Links = browser.find_elements_by_link_text("Annual")
for link in Links:
link.click()
time.sleep(20)
browser.switch_to_window(
我用Python编写了一个简单的代码,可以浏览存储在tuple中的几个网页。其目标是定期浏览这些页面,并检查它们是否在线并作出响应。样本代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
browser = webdriver.Chrome()
l
我已经把selenium下载到我的Mac上了。我试图使用selenium在python中运行一个脚本,但是我得到了错误:
Traceback (most recent call last):
File "selenium.py", line 3, in <module>
from selenium import webdrive
File "/Users/shynds23/python/selenium.py", line 3, in <module>
from selenium import webdriver
Impo
我在python中用selenium编写了一个脚本,以便从网页中获取标题地址。我在脚本中使用的url将在几秒钟内自动重定向。这就是我的脚本遇到错误的地方。我把那错误的一部分贴在纸上给你一个主意。
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
我试过的脚本:
from contextlib import
我做了一个程序来抓取youtube链接并将其输入到网站上,但它无法找到输入box...plz告诉我为什么
import time
from selenium import webdriver
import pyautogui as auto
url = 'https://www.youtube.com/results?search_query=closer+8d'
web = webdriver.Chrome('chromedriver.exe')
web.get(url)
time.sleep(
我是python和selenium的新手。我想使用python selenium打印给定代码段的pre标记中的文本。
<body><pre style="word-wrap: break-word; white-space: pre-wrap;">
" sample text i want to get
print this using python selenium
"
</pre></body>