草庐IT

webdrive

全部标签

c# - Selenium WebDriver - 如何使用 C# 设置页面加载超时

我正在使用Selenium2.20WebDriver通过C#创建和管理firefox浏览器。要访问页面,我使用以下代码,在访问URL之前设置驱动程序超时:driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));//Setimplicitwaittimeoutsto5secsdriver.Manage().Timeouts().SetScriptTimeout(newTimeSpan(0,0,0,5));//Setscripttimeoutsto5secsdriver.Navigate().GoToUrl(my

c# - Selenium WebDriver - 如何使用 C# 设置页面加载超时

我正在使用Selenium2.20WebDriver通过C#创建和管理firefox浏览器。要访问页面,我使用以下代码,在访问URL之前设置驱动程序超时:driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));//Setimplicitwaittimeoutsto5secsdriver.Manage().Timeouts().SetScriptTimeout(newTimeSpan(0,0,0,5));//Setscripttimeoutsto5secsdriver.Navigate().GoToUrl(my

Python selenium中出现错误:driver = webdriver.chrome() TypeError: ‘module‘ object is not callable

目录代码如下报错详情解决办法方法一:方法二:方法三:代码如下fromseleniumimportwebdriverimporttimedriver=webdriver.chrome()driver.get("https://www.baidu.com")time.sleep(3)driver.find_element_by_id("kw").send_keys("花千骨")driver.find_element_by_id("su").click()driver.quit()报错详情解决办法方法一:chrome的首字母应该为大写,如下:driver=webdriver.Chrome()修改代码

c# - Selenium 错误 - 对远程 WebDriver 的 HTTP 请求在 60 秒后超时

我已经使用Selenium好几个月了,我们用它来自动化我们的一些内部测试流程。脚本一直通过良好。我最近使用FF27.01升级到C#2.40.0webdriver,我们的脚本现在在随机位置失败并出现以下错误。[Portal.SmokeTest.SmokeRunTest.Booking]TearDownmethodfailed.OpenQA.Selenium.WebDriverException:TheHTTPrequesttotheremoteWebDriverserverforURLhtt(p)://localhost:7055/hub/session/56e99e88-ba17-4d

c# - Selenium 错误 - 对远程 WebDriver 的 HTTP 请求在 60 秒后超时

我已经使用Selenium好几个月了,我们用它来自动化我们的一些内部测试流程。脚本一直通过良好。我最近使用FF27.01升级到C#2.40.0webdriver,我们的脚本现在在随机位置失败并出现以下错误。[Portal.SmokeTest.SmokeRunTest.Booking]TearDownmethodfailed.OpenQA.Selenium.WebDriverException:TheHTTPrequesttotheremoteWebDriverserverforURLhtt(p)://localhost:7055/hub/session/56e99e88-ba17-4d

c# - 如何使用 C# 在 Selenium WebDriver (Selenium 2) 中最大化浏览器窗口?

有什么方法可以使用带有C#的WebDriver(Selenium2)来最大化浏览器窗口? 最佳答案 driver.Manage().Window.Maximize();这适用于IE和Firefox。Chrome不工作。在ChromeDriver项目上为此提交了一个错误。与此同时,chrome的解决方案是实现JoeyV.和Coder323建议的内容。ChromeOptionsoptions=newChromeOptions();options.addArgument("--start-maximized");driver=newChr

c# - 如何使用 C# 在 Selenium WebDriver (Selenium 2) 中最大化浏览器窗口?

有什么方法可以使用带有C#的WebDriver(Selenium2)来最大化浏览器窗口? 最佳答案 driver.Manage().Window.Maximize();这适用于IE和Firefox。Chrome不工作。在ChromeDriver项目上为此提交了一个错误。与此同时,chrome的解决方案是实现JoeyV.和Coder323建议的内容。ChromeOptionsoptions=newChromeOptions();options.addArgument("--start-maximized");driver=newChr

Python Selenium WebDriver 如何设置请求头用户代理(User-Agent)参数

在本文中,将演示如何为浏览器设置用户代理,以及如何在PythonSeleniumWebDriver中读取用户代理。测试中的许多方案都需要操作用户代理。什么是用户代理?User-Agent请求标头包含一个特征字符串,该字符串允许网络协议对等方标识请求软件用户代理的应用程序类型、操作系统、软件供应商或软件版本。它显示在HTTP请求标头中,不适用于响应标头。所有浏览器都支持它。简而言之,用户代理是客户端(用户)的身份。用户代理的通过格式:User-Agent:Mozilla/()()Example:Mozilla/5.0(WindowsNT6.1;Win64;x64;rv:47.0)Gecko/20

报错 ‘selenium.webdriver‘ has no attribute ‘Chrome‘

小白在搭建python环境并创建第一个selenium项目后,调用chromedriver插件时,代码报错: ‘selenium.webdriver‘hasnoattribute‘Chrome‘  前提条件:已安装selenium,chromedriver插件放在正确路径下并添加到环境变量。解决方法:参考调用chrome插件失败当前项目虚拟环境下的解释器环境不具备调用chrome条件,换成systeminterpretor即可。

javascript - WebDriver executeAsyncScript 与 executeScript

executeAsyncScript和executeScript有什么区别?我如何使用诸如window.onload之类的事件?我试过这样的东西((JavascriptExecutor)driver).executeAsyncScript("window.onload=function(){alert('Hello')}");但是当然没用...所以如果有人知道它是如何工作的请写一个例子 最佳答案 (保持简单,正确。)execteScript和executeAsyncScript的相关区别是:使用executeAsyncScript调