在最近Firefox升级到版本47之后,我们被迫安装了Marionette扩展以继续使用selenium webdriver,在我的例子中还将selenium从2.52升级到2.53。
我使用python版本的selenium webdriver来获取用HTML和JavaScript呈现的地图的高分辨率图像。以前,这在火狐上运行得很好,屏幕截图可以拍摄整个页面,远远超出了我自己的屏幕尺寸。然而,随着最近的变化,屏幕截图只拍摄了屏幕上可见的区域。我使用以下代码:
import time
from selenium import webdriver
from selenium.webdriver.
我使用的是Firefox33.1.1版本和Selenium WebDriver 2.44。Selenium WebDriver是通过Nuget使用Install Selenium.WebDriver安装的。以前,我在运行测试时没有遇到任何问题。在我的所有测试中,我都开始得到以下错误:
SetUp : OpenQA.Selenium.WebDriverException : Failed to start up socket within 45000 ms
TearDown : System.NullReferenceException : Object reference not set to
我的代码:
import selenium
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.keys import Keys
import time, sys, datetime, calendar, os
browser = webdriver.Firefox()
loginURL = "some URL"
browser.get(loginURL)
浏览器窗口打开,但是它
尝试学习Selenium for Python (3.4.0),并在基本工作方面取得了成功--安装、打开浏览器和网页等等。但是,当我试图打开一个特定的HTML表单时,会遇到一个错误--与'driver.find_element_by_name‘开头的“驱动程序”有关。
我的代码是:
#vocab express logger onner
import selenium
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.ke
使用以下代码,在Mac上,我尝试使用Python和Selenium启动Tor浏览器:
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.firefox.service import Service
from selenium.webdriver.firefox.options import Options
from webdriver_manager.firefox import GeckoDrive
我有一个python脚本,以前运行得很好,但现在出现了错误,所以我不确定发生了什么。我得到的错误是:
C:\Users\663255\Desktop>PMI_Tests.py
Traceback (most recent call last):
File "C:\Users\663255\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
stdout=self.log_file, st
我已经在Linux中构建了一个简单的脚本,但现在我试图让它在windows上工作。
守则是:
require 'watir-webdriver'
puts "Press enter when ready to continue"
gets
browser = Watir::Browser.start "http://www.google.com"
# do stuff
它在Ubuntu上的工作原理与预期完全相同。但是,当我在Windows上试用它时,Firefox进程就会启动,但在您看到Firefox窗口之前就会死掉。这是Ruby在Windows
我有一个urls列表(+500),我需要它的html代码,但它非常慢。我可以异步下载它们吗?代码:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
我正在使用selenium创建一个用python编写的测试套件。然而,当我运行我的测试时,我得到的错误是:'PythonOrgSearch‘对象没有属性’驱动‘
我很确定这是因为测试没有按顺序运行,所以在测试完成之前,驱动程序就关闭了。我以前也收到了错误:“尝试运行命令而没有建立连接”,我认为这也表明测试没有按顺序运行,所以驱动程序没有启动?不过,我不确定这是准确的,只是我最好的猜测。我的代码看起来是:
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Ke
我正在将我的应用程序从过程代码重构为OOP。我正试着上这个驾驶课。
更新:这在Windows中有效,但在Mac中不起作用。
# IMPORTS
from sys import platform
import os
from os import system
from selenium import webdriver
from selenium.webdriver import Firefox, FirefoxOptions
from selenium.common.exceptions import NoSuchElementException
from selenium.webdrive
你好,伙计们,我一直在尝试在网页上刮一些包含不断变化的值的页面,但是到目前为止,我还无法得到价格。有人能帮我吗,这就是我现在到达的地方!
import requests
import bs4
from urllib.request import Request, urlopen as uReq
from bs4 import BeautifulSoup as soup
from selenium import webdriver
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.
我一直在开发一个web扫描应用程序,包括Selenium和Python2.7,运行在一个Raspberry Pi上。这个应用程序工作得很好,然后几分钟就走开了,而现在却不是了。
问题似乎与Selenium导入有关,我没有对这些文件进行任何更改。以下是我所看到的:
基本Python导入:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.s
我试图使用登录到一个网站。但是登录在引导模式对话框中,我无法使用我的代码成功登录。有人能告诉我我的密码出了什么问题吗?
我尝试了以下代码:
import requests
import time
import os, sys
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.by impor
import unittest
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.common.desired_ca
使用Python中的Selenium,我想下载一个页面,并保存由id标识的特定div的HTML代码。我有以下几点:
from selenium.webdriver import Firefox
from selenium.webdriver.support.ui import WebDriverWait
...
with closing(Firefox()) as browser:
browser.get(current_url)
WebDriverWait(browser, timeout=3).until(lambda x: x.find_element_by_id('
我使用Selenium来点击这个网页的“夜间会话”按钮。
html源如下所示:
<span class="ns ns_night">NIGHT SESSION</span>
这是我的代码:
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_condi
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
from selenium.webdriver.firefox.options import Options
options = Options()
options.headless = True
driv
以下代码在selenium-1中运行良好:
sel = self.selenium
sel.get_eval("window.$('body form div ul li').html()")
当我尝试在python中的selenium-2 webdriver中执行相同的操作时,我得到了一个错误。
wd = webdriver.Firefox()
wd.execute_script("window.$('body form div ul li').html()")
selenium.webdriver.common.excep
我使用的是Selenium3,因为我们知道已经对FireFox进行了修改(以前是一个简单的调用),现在我们必须在属性中设置它,指向geckodriver。
我使用的是铬驱动程序,但是得到了错误:
The path to the driver executable must be set by the webdriver.gecko.driver system property.
这是m码:
import org.openqa.selenium.chrome.*;
import org.openqa.selenium.WebDriver;
//import org.openqa.selenium