我正在使用Splinter和Python自动化一个网站。我能够在Selenium中使用send_keys()方法,但不能一次发送多个键,例如browser.driver.find_element_by_name('q').send_keys(Keys.CONTROL + 't')
没有发生错误或异常,但代码不像预期的那样工作。
import time
from selenium import webdriver
from splinter import Browser
from selenium.webdriver.common.keys import Keys
我想使用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
最近,我偶然发现了自动化网站的java代码,于是我改用python并执行。
在执行代码时,提交按钮不起作用。有没有人能推荐一种更好的方法来实现这段代码?
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support impor
我有一个脚本,它将打开eBay并使购买过程自动化,并且它可以工作…。一段时间。经过一系列循环之后,它随机开始跳过将数据发送到文本字段。这个脚本总是在第一次完美的运行,但偶尔在第2或第10次迭代之间,它就会中断;到目前为止,它还没有通过第10个循环。
我使用Python2.7、Chrome 47 (带有chrome驱动程序)和Selenium 2.53.5。
下面是我代码的一部分:
for o in orders:
if (o[1] == "Batteries"):
driver.get("http://www.ebay.com/itm/20-Piece-Comb
尝试在pycharm中运行下面的Selenium代码,测试没有错误地执行,但是没有执行定义在类GoogleSearch中的函数。需要帮助找出问题所在!!
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys
import unittest
class GoogleSearch(unittest.TestCase):
print("123")
@classmethod
def setUpClass(cls):
我正试着用鼠标右键点击selenium python中的另存为图像。我可以使用下面的方法执行右键单击,但是下一个执行右键单击的操作不再起作用。我该如何解决这个问题?
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
driver.get(url)
# get the image source
img = driver.find_element_by_xpath('//img'
我正试图与facebook上一个名为"Fname Lname“的朋友打开一个聊天窗口,但是Python抛出了一个错误。奇怪的是,相同序列中的相同代码在空闲时工作非常好,但在运行脚本文件时却不工作。
#! python3
#sends a facebook message to a friend after logging in
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
fb=webdriver.Chrome()
fb.get('https://www.fac
我正在尝试在python中使用selenium登录一个网站()。
我很难将文本(从python代码中的密码变量)发送到网站上的密码文本框字段。
这是我的代码:
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui impor
我正在尝试使用Python中的Selenium创建一个简单的脚本来执行以下操作:一旦我的服务器中的IP发生更改,它将直接进入我的帐户,并用新的IP更新服务器的IP。到目前一切尚好。我可以做任何事情,直到我走到最后一步。到目前为止,让我向您展示我的代码: from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os
cwd = os.path.dirname(os.path.realpath(__file__))
d = webdriver.Chrome(cwd +
我有一个名为create_cpe.py的脚本,它打开火狐并创建一个cpe。
create_cpe.py
# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElemen
所以,我正在尝试在我的新电脑上使用selenium,但是我遇到了这个问题,我真的不知道我能做些什么来解决它。 代码如下: driver = webdriver.Firefox(executable_path='./geckodriver') # launch firefox
driver.get("https://www.tiktok.com/@programm___r?lang=en") # go to the website
WebDriverWait(driver,20).until(EC.element_to_be_clic
就像主题说的,我想打开网页,双击word,然后选择单词做鼠标右键点击,然后从菜单中选择复制。到目前为止,我有以下代码做一切,打开谷歌,点击word,调用鼠标右键单击,但我不知道如何做/使用向下箭头键选择复制。以下是代码:
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Firefox()
drive