Tag: selenium

量angular器 – 识别Ui-Sref链接

我试图通过以下标识以下html的链接。 我已经使用npm安装linkUiSref。 但我仍然得到对象没有方法linkUisref。 请指教。 (by.linkUiSref(element(by.css('#monitoring-tab> ul> li:nth-​​child(2)> a')))) <nav id="monitoring-tab" class="pure-menu pure-menu-open pure-menu-horizontal ng-scope"> <ul> <li ui-sref-active="pure-menu-selected" ng-hide="hideTab.now" class="pure-menu-selected"> <a ui-sref="app.monitoring.real-time" href="#/monitoring/real-time"> Now </a> </li> <li ui-sref-active="pure-menu-selected" class=""> <a ui-sref="app.monitoring.historical.day" href="#/monitoring/historical/day"> Day</a> </li> <li ui-sref-active="pure-menu-selected" class=""> <a ui-sref="app.monitoring.historical.month" href="#/monitoring/historical/month"> Month</a> </li> <li ui-sref-active="pure-menu-selected" class=""> <a ui-sref="app.monitoring.historical.year" href="#/monitoring/historical/year"> Year</a> </li> <li ui-sref-active="pure-menu-selected" class=""> <a ui-sref="app.monitoring.historical.lifetime" href="#/monitoring/historical/lifetime"> […]

networking驱动程序的示例不起作用

我npm安装了selenium-webdriver 。 下载IE组件,并把它放在我的path(使用Windows 8)。 打开IE浏览器并将所有安全区域设置为高,他们需要相同,但由于“受限制的网站”不允许我将其设置为高但我必须将所有其他更改为高。 然后运行\ node_modules \ selenium-webdriver \ example \ google_search.js的修改版本: var webdriver = require('..'), By = webdriver.By, until = webdriver.until; var driver = new webdriver.Builder() .forBrowser('ie') .build(); driver.get('https://www.google.com/?gws_rd=ssl');//no redirect driver.findElement(By.name('q')).sendKeys('webdriver'); driver.findElement(By.name('btnG')).click(); driver.wait(until.titleIs('webdriver – Google Search'), 1000); driver.quit(); IE浏览器启动并打开谷歌,然后我得到以下错误: NoSuchElementError:找不到使用CSSselect器的元素== * [name =“q”] 我很确定元素是在“查看源代码”给我的页面上 <input class="lst lst-tbb sbibps" id="lst-ib" maxlength="2048" name="q" 这可能实际上是IE的问题,因为在google.com上document.body.querySelector("*[name=\"q\"]")在IE 11中返回未定义,但这将意味着不能使用seleniumIE浏览器。 […]

守护程序不会在browser.end()后终止

我启动启动我的本地服务器的subprocess后运行Nightwatch。 Nightwatch运行testing,它们成功完成,浏览器窗口全部closures,但是在打印“确定”10个总断言通过之后, nightwatch进程继续运行。 我认为这可能与我如何看nightwatch过程中的事件有关,但据我所知,我正在观看所有可能表明守夜人正在退出的事件。 runner.js shutdown()方法永远不会被调用。 testing结束后,如何让Nightwatch终止? 更新 如果我删除sign-in.js中的最后一个testing,则Nightwatch按预期退出。 runner.js import spawn from 'cross-spawn' // 1. start the dev server using production config process.env.NODE_ENV = 'testing' let servers function shutdown (result) { console.log('HERE', result) try { // Passing a negative PID to kill will terminate all child processes, not just the parent if (servers) process.kill(-servers.pid) […]

使用量angular器webdriverpipe理器closuresselenium webdriver

我试图从最新版本的独立selenium服务器+最新的IE驱动程序升级量angular器从版本4.0.14到5.0.0,并面临的问题,通过webdriver-manager发送关机命令,什么都没有发生,我仍然看到进程和运行。 这里更详细的环境信息: Windows 7 64位 Node.JS 6.9.1 NPM 3.10.8 量angular器包5.0.0 Webdriverpipe理员状态给出了这一点 [15:26:20]我/状态 – selenium独立版本可用:3.0.1 [最后] [15:26:20] I / status – chromedriver版本可用:2.26 [默认] [最后] [15:26:20]我/状态 – geckodriver版本可用:v0.12.0 [默认] [最后] [15:26:20] I / status – IEDriverServer版本可用:Win32_3.0.0 [last] [15:26:20]我/状态 – android-sdk不存在 [15:26:20] I / status – appium不存在 testing运行在IE 11上 webdriver开始与这些参数的量angular器webdriverpipe理器脚本: – 分离 – 安静 –started,能指 –versions.standalone = 3.0.1 […]

如何查看从node.js发送到服务器的请求?

关于这个问题: 在nodejs / protractor中将cookies从一个请求传递到另一个请求 我有另一个。 我怎么能查看完整的请求(标​​题+正文),我正在通过nodejs执行?

如何在Heroku上使用Selenium Webdriver?

我正在开发一个Node.js应用程序,我使用Selenium Webdriver进行刮取。 但是,当我在Heroku上部署时,Selenium不起作用。 我如何让Selenium在Heroku上工作?

再次使用相同的实例webdriverJS

我对Selenium真的很陌生。 我设法使用下面的nodejs代码打开一个网站 var webdriver = require('selenium-webdriver'); var driver = new webdriver.Builder() .forBrowser('chrome') .build(); console.log(driver); driver.get('https://web.whatsapp.com'); //perform all other operations here. https://web.whatsapp.com打开,我手动扫描QR码和login。现在我有不同的JavaScript文件来执行操作,如删除,在web.whatsapp.com内清除聊天等… 现在,如果我得到一些错误,我debugging,当我使用node test.js再次运行脚本,需要另外2分钟来加载页面,并执行我需要的步骤。 我只是想重新打开已经打开的选项卡,并继续我的脚本,而不是新的窗口打开。 编辑第2天:仍在search解决scheme。 我试着下面的代码保存对象,并重用它..这是正确的方法? 虽然我得到一个JSONparsing错误。 var o = new chrome.Options(); o.addArguments("user-data-dir=/Users/vishnu/Library/Application Support/Google/Chrome/Profile 2"); o.addArguments("disable-infobars"); o.addArguments("–no-first-run"); var driver = new webdriver.Builder().withCapabilities(webdriver.Capabilities.chrome()).setChromeOptions(o).build(); var savefile = fs.writeFile('data.json', JSON.stringify(util.inspect(driver)) , 'utf-8'); var parsedJSON = require('./data.json'); console.log(parsedJSON);

如何在使用NightwatchtestingNode.js项目时在Travis CI上运行Selenium Server

我有一个node.js项目 ,我正在尝试使用Nightwatch进行testing。 守夜服务器使用selenium服务器。 我的testing在本地正常工作,但是在Travis上它立即窒息了这个错误 : 启动Selenium服务器时发生错误: 线程“main”中的exceptionjava.lang.UnsupportedClassVersionError:org / openqa / grid / selenium / GridLauncherV3:不支持的major.minor版本52.0 我认为这意味着它想要Java 8或更新,但我不知道如何设置在Travis上。 我尝试在我的travis.yml中设置jdk: oracle8jdk ,但是这似乎没有什么区别。 (也许这只适用于Javatesting?) 有什么build议么?

用Selenium WebDriverJsclosures警报

我一直在努力尝试closures警报浏览器打开只有一个特定的模式,我不控制,所以我需要一段代码,检测并closures警报能够继续浏览网页,而不是停止执行。 我尝试了几种处理警报的方法,但目前没有一个成功: 以下是我一直在使用的一些示例: 1: driver.wait(driver.switchTo().activeElement().then( function() { console.log("alert detected"); driver.switchTo().alert().accept(); }, function() { console.log("no alert detected"); } ), 1000); 2: driver.wait(driver.switchTo().alert().accept() .then(null, function(err) { console.log("ERROR ALERT"); console.log(err); console.log("ERROR NAME"); console.log(err.name); }), 1000); 3:注入这段代码试图覆盖浏览器的警报,使其不显示: driver.executeScript('alert = function(){};'); 基本上这三个是我一直在努力的主要解决方法,但目前似乎没有任何工作正常。

Heroku上的PhantomJSpath

我有一个在Heroku上运行的节点应用程序。 我在python中使用selenium来抓取一个网站,并在我需要的时候从我的节点app调用python脚本。 我在我的Mac上安装PhantomJS,当我在本地运行应用程序(节点index.js)时,一切正常。 path_to_phantom = '/Users/govind/Desktop/phantomjs-2.1.1- macosx/bin/phantomjs' browser = webdriver.PhantomJS(executable_path = path_to_phantom) 然而,Heroku似乎没有任何工作。 我也将PhantomJS buildpack添加到我的节点应用程序,但它只是不会调用python脚本。 我认为这个问题是通往PhantomJS buildpack的path。 我应该添加什么path? 还是有我在这里失踪的其他方面?