草庐IT

pytest-selenium

全部标签

java - 使用 selenium webdriver 完全滚动 ajax 页面

我正在尝试使用此代码完全滚动页面:JavascriptExecutorjs=(JavascriptExecutor)Browser;js.executeScript("javascript:window.onload=toBottom();"+"functiontoBottom(){"+"window.scrollTo(0,Math.max(document.documentElement.scrollHeight,"+"document.body.scrollHeight,document.documentElement.clientHeight));"+"}");js.execut

windows - Selenium 服务器 : Unexpected status SERVICE_PAUSED

尝试在Windows10中将SeleniumServer作为服务(使用nssm)安装失败,并在nssmstartselenium-server上显示UnexpectedstatusSERVICE_PAUSED。Selenium是selenium-server-standalone-2.53.0.jar。nssm为2.24。操作系统是Windows10、1511、32位。事件查看器说Serviceselenium-serverranforlessthan1500milliseconds.Restartwillbedelayedby16000milliseconds.目标是使用codece

selenium的安装及配置

文章目录1.selenium简介2.selenium安装3.selenium浏览器驱动3.1selenium驱动下载3.2selenium驱动设置4.验证驱动是否可用5.selenium程序1.selenium简介Selenium是最广泛使用的开源WebUI(用户界面)自动化测试套件之一。Selenium支持的语言包括C#,Java,Perl,PHP,Python和Ruby。目前,SeleniumWeb驱动程序最受Python和C#欢迎。Selenium测试脚本可以使用任何支持的编程语言进行编码,并且可以直接在大多数现代Web浏览器中运行。在爬虫领域selenium同样是一把利器,能够解决大部

python - Selenium webdriver.Firefox() 永远不会返回

~/selenium-test$whichgeckodriver/cygdrive/c/Windows/geckodriver~/selenium-test$geckodriver--version|head-n1geckodriver0.11.1~/selenium-test$python-iPython2.7.12(v2.7.12:d33e0cf91556,Jun272016,15:24:40)[MSCv.150064bit(AMD64)]onwin32Type"help","copyright","credits"or"license"formoreinformation.>>>

python - 如何使用 pythonw 运行 Selenium Webdriver?

我正在尝试通过Windows中的GUI应用程序在Selenium脚本中打开Firefox浏览器。它在使用python.exerunw.py运行时很好,但是当我使用pythonw.exerunw.py运行它时,浏览器无法启动。相反,它抛出这个异常:Traceback(mostrecentcalllast):File"bin\runw.py",line215,inprocess_instanceinstance.setup()File"bin\mixin.py",line181,insetupself.browser=self.get_firefox_browser()File"bin\m

软测入门(六)pytest单元测试

pytestpytest是python的一种单元测试框架,同自带的unittest测试框架类似,但pytest更简洁高效。单元测试:测试函数、类、方法能不能正常运行测试的结果是否符合我们的预期结果安装pipinstall-Upytest基本使用通过pytest包使用importpytestdeftest_a():print("test_a")return1+0deftest_b():print("test_b")return1/0if__name__=='__main__':pytest.main()默认情况下:在main中直接使用pytest的main()方法,会把文件中所有test_*开头

c# - Selenium WebDriver - 找不到 Chrome 二进制文件

我正在尝试使用Chrome运行Selenium测试。我正在使用C#。varoptions=newOpenQA.Selenium.Chrome.ChromeOptions();options.BinaryLocation=@"C:\Users\Vilem\AppData\Local\Google\Chrome\Application\";using(IWebDriverdriver=newOpenQA.Selenium.Chrome.ChromeDriver(options)){...似乎找到了chromedriver.exe,但它可以找到Chrome二进制文件。我在自动搜索失败后显式设

c# - 从 Selenium webdriver 的当前窗口 GUID 获取窗口句柄 (IntPtr)

我正在trycatch整个浏览器屏幕(例如任何工具栏、面板等)的屏幕截图,而不仅仅是整个页面,所以我得到了这段代码:using(FirefoxDriverdriver=newFirefoxDriver()){driver.Navigate().GoToUrl(url);ScreenCapturesc=newScreenCapture();//HowcanIfindnaturalIntPtrhandleofwindowhere,usingGUID-likeidentifierreturningbydriver.currentWindowHandle?Imageimg=sc.Capture

selenium扫码登录操作edge

fromseleniumimportwebdriverfromselenium.webdriver.common.byimportByfromselenium.webdriver.common.action_chainsimportActionChainsfromselenium.webdriver.common.keysimportKeysimportjsonimporttimedriver=webdriver.Edge()deflogin_scan():#驱动器下载链接https://developer.microsoft.com/en-us/microsoft-edge/tools/we

c# - 如何从父元素获取文本并从子元素中排除文本(C# Selenium)

在Selenium中是否可以仅从父元素而不是其子元素获取文本?例子:假设我有以下代码:GoogleLinkThislinkwilltakeyoutoGoogle'shomepage....在C#(或任何语言)中,我将拥有:stringlinktext=driver.FindElement(By.CssSelector(".linksSection>a#google")).Text;Assert.AreEqual(linkText,"GoogleLink","GoogleLinkfailstexttest.");但是,链接文本将包含“GoogleLinkThislinkwilltakey