我想检查一个web元素的内部文本,但是即使我给了它绝对路径,xpath也找不到它。在我试图定义Plaje的行中没有这样的元素错误
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
driver = webdriver.Edge("D:\pariur
在另一个上也提出了一个类似的问题
from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
browser = webdriver.Firefox()
element = WebDriverWait(browser, 10).until(EC.presence
我正在尝试使用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脚本,它将在登录请求后运行fill up a form。我已经能够填写我的登录详细信息,然后单击“提交”,之后浏览器会自动关闭。这是我用来登录的代码。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import ui
def page_is_loaded(driver):
return driver.find_element_by_tag_name("bo
我在python控制台上检索文本时没有成功。Python/Selenium认为它是空白的,因此显示了Failed to obtain text(如结果图像所示)。
Python代码:
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
#Feature: Joke Generator Button
#Scenario: Click button to move onto next jokes.
def test_joke():
#Given the websit
我是selenium的新手,并构建了一个项目(python + selenium)。我已经在像time.sleep(10)这样的代码中插入了一个自定义等待,我试图执行的是,代码应该被阻塞,直到页面被完全加载并且在单击按钮后相同。我几乎没有读过像
implicit wait
explicit wait
wait untill an element appears up (select by id or something else )
是否有任何方法阻止代码,直到一个页面已经完全加载。(我没有任何条件可以等到)。我不能使用内容隐式等待或显式,因为没有固定的时间来完成加载页面。
def ru
我有一个id为"drp_autogen0“的下拉列表。我想单击下拉菜单,查看下拉菜单选项。当我尝试用Python和Selenium点击它时,我得到了这样的错误: selenium.common.exceptions.ElementNotInteractableException:消息: element not interactable I have attached the printscreen of the dropdown外观。我希望能够从列表中选择"Last month“,但我还没有做到这一点,因为下拉列表没有被点击。
下拉点击的代码如下所示:
html_list =
from selenium import webdriver # pip install selenium
import time
import re
# importing the module
from pytube import YouTube
def dnload(lnk):
# where to save
SAVE_PATH = "C:/Python/amazingrussian" #to_do
# link of the video to be downloaded
link=lnk
yt = YouTube(link)
在Jmeter中,当我试图使用显式时间等待元素时,等待语句将占用浏览器的隐式时间。在下面的代码中,我将浏览器等待时间设置为60秒,但在等待函数中,在条件失败之前只传递20秒。但是等待语句在失败之前花了整整60秒时间。
var selenium = org.openqa.selenium
var time = JavaImporter(java.util.concurrent.TimeUnit)
WDS.browser.manage().timeouts().implicitlyWait(60, time.TimeUnit.SECONDS)
var support_ui=JavaImporter
我正在写一个脚本来自动化一些不必要的教学反馈。
我正在使用selenium/python来抓取数据(学生姓名和班级等)并输入反馈信息。除了将反馈本身输入到textarea元素之外,一切都很好。Selenium在使用click()或send_keys()时给出了一个send_keys异常。
然后我尝试使用JS命令,例如:
comment = 'Thanks for coming to the lesson. Well done today!'
self.driver.execute_script(f'document.querySelector("#teacher
在python中使用Selenium时,我遇到以下错误:
selenium.common.exceptions.StaleElementReferenceException: Message: u'stale element reference: element is not attached to the page document\n
有趣的是,该错误在for循环中的不同时间弹出。有时它会通过例如。4次迭代和其他时间,例如。7.
正在运行的一些相关代码如下:
for i in range(0, 22):
u = driver.find_elements_by_id("
我正在从上抓取文本。我需要反复点击“加载更多的参数”才能获得页面上列出的所有参数。这是我的代码:
try:
while True:
link = WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.LINK_TEXT, "Load More Arguments")))
ActionChains(driver).move_to_element(link).perform()
link.click()
time.slee
我正在尝试使用Python Selenium下载Excel文件,方法是在此页面中单击“导出到Excel”:
在Chrome Inspect模式下,我认为元素的名称是"ete“
<div class="ete title_right" id="ete">Export to Excel</div>
下面是我的代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time
options = Op
我正在编写一个脚本,从一个我必须登录才能使用的站点中提取一些信息。我使用Python2.7.12和Selenium 3.4.3。
#!/usr/bin/python
from selenium import webdriver
browser = webdriver.Firefox(firefox_binary='/usr/bin/firefox', executable_path="./geckodriver")
# Get to the login page
browser.get('https://example.com')
browse
在我的selenium webdriver代码中,我试图让页面在开始查找元素并驱动它们(在用户名和密码中输入文本)之前等待加载。
我尝试使用driver.waitforpagetoload();,但它返回以下错误
Error 1 'OpenQA.Selenium.IWebDriver' does not contain a definition for 'waitforpagetoload' and no extension method 'waitforpagetoload' accepting a first argument of
我正在使用python脚本在chrome中登录gmail,但是在点击下一步返回错误的代码后,有人能帮我出什么问题吗,我是python的新手。下面是我使用的代码。
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.select import Select
import threading
import os,time,csv,datetime
from selenium.webdriver.support.ui import