Tag: selenium

使用Maven,量angular器和Selenium WebDriver进行集成testing

我们开发了一个Web应用程序,在后端使用Java,在UI中使用Angular,使用Maven作为构build系统。 我一直在尝试使用量angular器来设置自动化的集成testing,并且在Google负载/ StackOverflowing加载之后,仍然无法弄清楚如何实现最终的2端configuration。 Node.js / NPM安装(失败) 我已经尝试使用前端Maven插件来处理Node.js和NPM安装,但是由于我们是在公司防火墙的后面,似乎不可能直接下载任何东西。 虽然它可以从我们的Artifactory下载Node,但是在NPM下载失败(我不明白为什么它甚至会下载它,因为它是Node包的一部分)。 无论如何,我放弃了这个想法,并决定使用本地安装的节点。 启动Tomcat 为e2etesting启动/停止一个Tomcat实例很好地被处理 <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>${tomcat.manager.url}</url> <path>/</path> <server>Tomcat</server> </configuration> <executions> <!– Starting Tomcat –> <execution> <id>start-tomcat</id> <phase>pre-integration-test</phase> <goals> <goal>run</goal> </goals> <configuration> <!– Fork the process, otherwise the build will be blocked by the running Tomcat –> <fork>true</fork> <port>${tomcat.port}</port> <systemProperties> <!– We want to use […]

向Selenium Webdriver网格发出并行请求

我试图使用selenium服务器网格并行运行多个命令。 这是我的第一个testing代码: var webdriver = require('selenium-webdriver'); for(var u = 0; u < 3; u++) { makeScreenshot('foo/test' + u + '.png'); } function makeScreenshot(path) { var driver = new webdriver.Builder().forBrowser('firefox').usingServer('http://someurl:44111/wd/hub/').build(); console.log('Get'); driver.get('http://www.somepage.com').then(function() { console.log('Screenshot'); driver.takeScreenshot().then(function(data){ console.log(path); //var decodedImage = new Buffer(data, 'base64') driver.quit(); }); }); } 结果是: Get Get Get Screenshot foo/test0.png Screenshot foo/test1.png Screenshot foo/test2.png […]

Webdriver – pipe理更新错误

我是使用量angular器的新手。 试图安装一个独立的webdriver-manager但得到以下错误。 Node v7.2.0 Protractor 5.0.0 webdriver-manager 11.1.1 当我运行webdriver-manger update –standalone我得到以下错误 [17:25:21] I/file_manager – creating folder C:\Users\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium [17:25:22] E/downloader – undefined [17:25:22] I/update – chromedriver: file exists C:\Users\AppData\Roaming\npm\node_modules\protractor\node_modules\webdriver-manager\selenium\chromedriver_2.26win32.zip [17:25:22] I/update – chromedriver: unzipping chromedriver_2.26win32.zip **(node:14972) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Invalid filename (node:14972) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise […]

selenium用JavaScript获取元素的类属性

我正在使用Selenium使用Javascript编写testing自动化。 试图提取DOM元素的类属性不适用于我。 这是我的代码: var webdriver = require('selenium-webdriver'); var driver = new webdriver.Builder(). withCapabilities(webdriver.Capabilities.ie()). build(); var usernameField = driver.findElement(webdriver.By.id('username')); var classes = usernameField.getAttribute('class'); console.log(classes); 这将打印以下内容: { then: [Function: then], cancel: [Function: cancel], isPending: [Function: isPending] } 请指出如何find元素的属性值。

量angular器sendkeys不起作用:键码转换需要x显示

我正在尝试使用无头Chrome在Vagrant虚拟机内运行量angular器e2etesting。 我设法使用Xvfb工作,但是当我运行一个testing来填充表单时,我得到一个错误: 未知的错误:X代码转换需要X显示,考虑使用Xvfb 所有的testing运行良好,但只要我使用getKeys()(例如元素(by.model('user.email'))。sendKeys('admin');)我得到这个错误,即使我已经使用Xvfb。 我在跑: AngomanJS示例应用程序与Yeoman angular-fullstack生成器一起生成 Nodejs版本0.10.30,与nvm一起安装 stream浪者1.6.3 VirtualBox 4.3.14 主机操作系统Ubuntu 14.04 32位 客户操作系统Ubuntu 14.04 32位 铬37.0.2062.94 chromedriver 2.10.267517 我使用下面的shell脚本来启动Selenium和Xvfb: #!/ bin / sh的 webdriver-manager开始& Xvfb:1 -ac -screen 0 1280x1024x8& 导出DISPLAY =:1 我还添加了“export DISPLAY =:1”到/ opt / google / chrome / google-chrome。 同样,没有sendKeys()的testing运行良好。 我到目前为止所做的: 我正在运行32位的Ubuntu,所以我下载了chromedriver 2.10 32位,但没有帮助 我用–verbose运行chromedriver,并检查日志,但只显示相同的错误 我摆弄了Xvfb屏幕尺寸设置,也没有帮助 我在这里检查了一些源代码: https : //github.com/bayandin/chromedriver/blob/master/keycode_text_conversion_x.cc,并在第196行发现错误信息。当命令gfx :: […]

NodeJS应用程序中的function自动化Code​​Coverage

我正在寻找可以帮助我确定nodeJs中的function自动化覆盖的工具的指针。 (这不是unit testing!)。 我有很多运行在NodeJS中的前端应用程序的selenium自动化。 但是我想知道这些自动化的function覆盖面。 (我之前使用的是基于java的jacoco)

量angular器无法parsingconf.js

我正在使用量angular器为e2etesting我的angular应用程序,但得到: TypeError:调用“量angular器conf.js”时,对象#没有方法“parsing” 这里是conf文件的内容: exports.config = { seleniumAddress: 'http://localhost:4444/wd/hub', capabilities: { 'browserName': 'chrome' }, specs: ['HomePageCtrl_spec.js'], chromeOnly: true, jasmineNodeOpts: { onComplete: null, isVerbose: false, showColors: true, includeStackTrace: true } }; 这里是我正在运行这个命令的例外: E:\eCOIGit\sidhome\SidHome\SidHome.Tests\ng-test-e2e>protractor Conf.js 错误: C:\ Users \ xqwt \ AppData \ Roaming \ npm \ node_modules \ protractor \ node_modules \ q \ q.js:12 6 throw […]

WebDriverJs的资源?

我知道有以下资源: http://docs.seleniumhq.org/docs/03_webdriver.jsp https://code.google.com/p/selenium/wiki/WebDriverJs 但我想知道是否有一个WebDriverJs的整个API的网站。 我在哪里可以find可用的方法和具体参数发送? 类似于: http : //rubydoc.info/gems/watir-webdriver/frames

seleniumwebdriver迭代和导航node.js中的多个链接

从Casper.js迁移到Selenium有更多的工具。 尝试遍历多个链接并使用node.js和selenium-webdriver导航它们。 无法find任何文档或示例,无论我尝试运行哪个循环,都会收到错误。 iLinkCount = oLinks.length; console.log( oLinks ); console.log( iLinkCount ); 上面的代码输出链接计数到控制台,但我无法得到他们的href标签继续我的testing。 driver.findElements(webdriver.By.css( 'snip' ) ).then(function( oLinks ) { // driver.findElements(webdriver.By.xpath( "//snip" ) ).then(function( oLinks ) { iLinkCount = oLinks.length; console.log( oLinks ); console.log( iLinkCount ); // for( var oLink in oLinks ){ // var sLink = oLink.getAttribute('href'); // console.log( sLink ); // } […]

了解npm的“skippingAction模块在一个符号链接模块”

我试图强制使用npm的package.json selenium webdriver和量angular器版本的目的,但我得到以下错误信息: npm WARN install Couldn't install optional dependency: Unsupported npm WARN skippingAction Module is inside a symlinked module: not running add lru-cache@2.7.0 node_modules/findup-sync/node_modules/minimatch/node_modules/lru-cache npm WARN skippingAction Module is inside a symlinked module: not running add sigmund@1.0.1 node_modules/findup-sync/node_modules/minimatch/node_modules/sigmund npm WARN skippingAction Module is inside a symlinked module: not running add async@0.9.2 node_modules/grunt-protractor-runner/node_modules/async npm WARN […]