我试图使用Selenium将关键输入发送到我使用Phaser创建的HTML5游戏中。然而,我很困惑为什么我不能让它工作。当我在2048年或其他网站(如google、python等)上尝试使用相同的代码时(但不适用于其他通过phaser构建的HTML5游戏)。任何提示或指针都是非常有用的!
在python代码下面:
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import
我有个关于硒的问题。
我的想法:
我的想法是制作一个Python脚本来登录这个网站。Selenium将用户名和密码发送到HTML输入字段并提交。
问题:
我的代码一直在说:
Message: no such element: Unable to locate element:
例如,我已经用google.com尝试了这段代码,这是可行的。为什么这不适用于这个登录页面?有人能帮我吗?
我的Python代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import time
lo
我一直在使用python进行web自动化测试。自动化的关键部分是为HTML页面中的用户可见对象找到正确的元素。下面的API大部分时间都能工作,但并不是所有时间都能工作。
find_element_by_xxx, xxx can be id, name, xpath, tag_name etc.
当HTML页面太复杂时,我想搜索dom树。想知道是否可以要求selenium服务器序列化整个DOM (可以使用元素id通过webdriver执行操作)。客户端(python脚本)可以执行自己的搜索算法来找到正确的元素。
请注意,python selenium可以通过以下方式获得整个html页面
dr
在这里的几个线程中,有一个针对selenium拖放的变通方法,用于使用HTML5进行拖放的页面。这个变通方法涉及到使用javascript来模拟拖放,例如Unable to perform HTML5 drag and drop using javascript for Selenium WebDriver test和https://gist.github.com/rcorreia/2362544。这个解决方案在这个页面上效果很好,http://the-internet.herokuapp.com/drag_and_drop。 一般的方法是将这里的javascript文件(https://g
我正试着写一个Selenium机器人在抽搐中搜索。我可以单击搜索栏,但不能将任何值发送到搜索栏。
有什么问题吗?我工作了几个小时,但解决不了问题。
这是我的密码:
from selenium import webdriver
#https://selenium-python.readthedocs.io/
from selenium.webdriver.common.keys import Keys
#from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
我试图让这个脚本发送一个制表键输入后,将数据插入到输入字段。原因是下一组数据将被输入到下一行中。 ? 我尝试使用send_key方法将选项卡按钮事件发送到浏览器,但得到了一个错误。根据这个代码示例,有没有一种正确的方法来调用tab键键盘输入? from selenium.webdriver.common.keys import Keys
def GetQuote():
for i in range(len(orders)):
#description
driver.find_element(By.XPATH, "/html[1]/bo
我是硒和蟒蛇方面的新手。我试图使用selenium查找元素,但无论我尝试了什么(xpath、CSS),我总是收到以下消息:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element
在这里,我写的代码:
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.supp
我有这个代码去,搜索查询和选择第一个元素,并下载rom,但它总是选择相同的元素,尽管不同的查询,我第一次以为网站给出相同的顶部结果,但我用我的浏览器检查,但它给出不同的结果,我如何解决/做这个?
我的代码:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.c
该网站为。当我想要本地化右上角的搜索字段并将关键字发送到那里时,它可以工作。但是,当我想在执行一次搜索后执行相同的操作时,它不起作用。selenium可以定位元素,但不能向其发送密钥。为什么会发生这样的事情,我怎么才能避免呢?
while True:
try:
a = self.webdriver.find_element_by_xpath('/html/body/div[3]/div[1]/div[2]/div[2]/div/div[2]/div/form/div/input')
except:
pass
else:
忽略葡萄牙语的评论
from selenium import webdriver
from time import sleep
from bs4 import BeautifulSoup
from selenium.webdriver.common.by import By
driver=webdriver.Chrome('C:/Users/LENOVO/Desktop/WEB SCRAPPING/Selenium/chromedriver.exe')#padrão
driver.get('https://stackoverflow.com/questions/726
我正在使用selenium学习自动化,现在我有一点被一个元素挡住了。我不知道为什么它被认为是不可见的,但类似的元素在网站的另一部分被认为是可见的,我没有遇到任何问题点击他们。
要向您介绍有关的部分,如下所示:
📷
这是一个不同班次的日历,有三个分开的部分。
当我试图点击橙色移位,我有一个错误,它告诉我这个元素是不可见的。但是在我的其他脚本中,它们执行相同的操作,但是在另一个转换中,它工作得很好。
我的脚本如下:
# Check if the shift is on the schedule or not.
if (len(admin.find_elements_by_xpath(
是否可以将使用Selenium (使用Excel )捕获的HTML源代码存储到HTMLDocument元素中?这是一个使用Microsoft Internet Controls和Microsoft HTML Object Library实现Internet自动化的例子。
Dim IE as InternetExplorer
Dim HTML as HTMLDocument
Set IE = New InternetExplorer
ie.navigate "www.google.com"
set HTML = IE.Document
同样的穹顶和硒也可以吗?例如(不起作用!):
当在Django项目上运行Selenium测试时,我已经开始获得错误:
selenium.common.exceptions.WebDriverException: Message: Element is not clickable at point (61, 24.300003051757812). Other element would receive the click: <a class="navbar-brand" href="#"></a>
这很奇怪,原因有两个:第一,以前通过的测试,我还没有编辑代码库的这一部分。其次,当Se