我想用selenium-webdriver在facebook.com上login。 var webdriver = require('selenium-webdriver'), By = require('selenium-webdriver').By, until = require('selenium-webdriver').until; var driver = new webdriver.Builder() .forBrowser('firefox') .build(); driver.get('https://www.facebook.com/login'); driver.findElement(By.id('email')).sendKeys('****'); driver.findElement(By.id('pass')).sendKeys('*****'); driver.findElement(By.id('loginbutton')).click(); driver.findElement(By.linkText('Settings')).then(function(element) { console.log('Yes, found the element'); }, function(error) { console.log('The element was not found, as expected'); }); driver.quit(); 这是给错误: /home/shubham/node_modules/selenium-webdriver/index.js:25 const builder = require('./builder'); ^^^^^ SyntaxError: Use of const in strict mode. at […]
任何人都知道如何使用selenium2与Phpunit? PHP中是否有Selenium 2样本?
截至本文发布之日,“Microsoft Edge”这个名称已经正式宣布为新的Windows 10的默认浏览器。 现在可能为时过早,但我想知道是否有一个新的Selenium WebDriver可用,如果没有,告诉我们等待多久,直到我们看到一个开发? (Windows 10的技术预览已经出来,所以这似乎不是一个愚蠢的问题给我。)
我试图更好地理解testing框架,并一直在研究selenium。 我之前使用过HTMLUnit ,主要是当我需要从网站或类似的东西上刮掉一些信息的时候。 在编写testing自动化的时候,Selenium和HTMLUnit的优缺点是什么? 在我看来Selenium比HTMLUnit设置起来要复杂得多,虽然同时还有一个Selenium的HTMLUnitDriver,我认为它的行为与HTMLUnit本身的行为完全相同。 Selenium显然提供了更强大的框架,它具有用于Parareltesting的Selenium RC,它也有不同的浏览器驱动程序可以使用 – 尽pipe当您使用浏览器驱动程序时,testing实际上会打开/closures浏览器应用程序而不是无头的。 可能是我不正确的理解selenium。 一些方向和指针将是伟大的! 在另一个说明 – 一个单独的问题 – 我也在做移动浏览器的自动化testing,我看到Selenium有一个IPhoneDriver ,但这不是一个无头testing,因为它需要实际的iOS模拟器。 有没有办法在移动网站上进行无头testing? 更改用户代理是否足够? 我已经看到了一些关于改变用户代理的post,这些代码似乎有自己的挑战,例如。 在Selenium RC中设置用户代理 非常感谢!
比方说,我有一个forms的input (看起来像一个button,并像一个button交互),它会生成一些数据(嗯,服务器生成基于表单参数的数据,但对于用户来说,button做:))基于表单中的参数。 当我使用click() ,整个过程挂起(它实际上冻结,没有例外或错误)。 来自Selenium网站: // Now submit the form. WebDriver will find the form for us from the element element.submit(); 所以WebDriver有一个submit()方法。 在button或submit()上使用click()之间有什么区别,逻辑明智吗?
我使用seleniumwebdriver,我怎样才能检查一些文本是否存在或不在页面中? 也许有人推荐我有用的资源,我可以阅读有关它。 谢谢
我用Python启动并closures了phantomjs from selenium import webdriver driver = webdriver.PhantomJS() driver.get(url) html_doc = driver.page_source driver.close() 但脚本结束执行后,我仍然在我的Mac活动监视器中findphantomjs一个实例。 实际上,每次运行脚本时phantomjs创build一个新的进程phantomjs 。 我应该如何closures驱动程序?
我需要一种方式来截取我的functiontesting。 现在我用Selenium 2和C#绑定。 我非常想在testing结束时截图,以确保显示所需的页面。 有什么特定的工具,你们知道,我可以将其纳入我的C#代码,将触发屏幕截图? 我找不到内置的Selenium 2解决scheme(无需查看)。
我使用selenium2 Web驱动程序来testing使用AJAX的用户界面。 有没有办法使驱动程序等待一点,这样的Ajax请求将完成 基本上我有这个: d.FindElement(By.XPath("//div[8]/div[3]/div/button")).Click(); // this^ click triggers an ajax request which will fill the below Id with content // so I need to make it wait for a bit Assert.IsNotEmpty(d.FindElement(By.Id("Hobbies")).Text);
如何获取Selenium中的HTTP状态码? 例如,所以我可以testing,如果浏览器请求/用户/ 27,并没有用户ID = 27存在,一个HTTP 404返回? 我的主要兴趣是Selenium RC,但如果有人知道“正常”selenium的答案,我可以很容易地把它翻译成RC。 /皮特