Tag: webdriver

如何操作Jasmine JS在Webdriver的“文本”validation?

我已经尝试了很多代码,但没有通过testing。 通常,当试图读取此validation时,testing失败,或者收到“false”而不是“true”。 所有的脚本如下: describe('LiveSite Portal – Client share a document ', function() { it('LiveSite – Home Page', function() { liveSiteHome(); }); it('LiveSite Portal – Client share a document – Load new document', function() { element(by.xpath("//div[@class='actions-row']//a[.='Share Document']")).click(); browser.sleep(2000); expect (element(by.xpath("//div[@class='upload-section']/div[1]/div[2]/div")).isPresent()).toBe(true); captureScreen("documentForm"); browser.sleep(2000); element(by.css("input.file-input.upload-file-input")).sendKeys("C:\\automation\\myDocument.docx"); browser.sleep(3000); var reviewElement = element(by.bind('selectedFiles[0].name')); // expect (reviewElement.getText('myDocument.docx').isPresent()).toBe(true); expect(reviewElement.getText()).toEqual("myDocument.docx"); captureScreen("documentLoaded"); browser.sleep(2000); element(by.xpath("//div[@class='upload-section']/div[2]/div[2]/textarea")).sendKeys("Hi This […]

从promise块返回函数中的值

我正在尝试编写一个函数(使用WebdriverJS lib)遍历元素列表,检查名称并构build与该名称相对应的xpath定位器。 我在这里简化了xpath定位器,所以不要留意。 我在这里遇到的问题是:1)调用这个函数返回undefined。 据我所知,这是因为return语句不在其位置上,而是:2)将它放在一个正常的同步代码正常工作的地方,不适用于asynchronouspromise,因此调用此函数将返回同样未定义,但是因为return语句在“driver.findElement”语句之前触发。 如果我想通过调用这个函数得到createdTaskvariables,我应该如何在这里使用return语句? var findCreatedTask = function() { var createdTask; driver.findElements(By.xpath("//div[@id='Tasks_Tab']")).then(function(tasks) { for (var index = 1; index <= tasks.length; index++) { driver.findElement(By.xpath("//div[@id='Tasks_Tab'][" + index + "]//div[@class='task-title']")).getText().then(function(taskTitle) { if (taskTitle == "testName") { createdTask = "//div[@id='Tasks_Tab'][" + index + "]"; return createdTask; } }); } }); };

虚拟机上NodeJS的量angular器 – 如何修复错误199?

我想在虚拟机上使用量angular器,得到错误代码199。 我正在按照这个教程完全相同的步骤 – http://www.protractortest.org/#/tutorial 当我在命令行上input量angular器conf.js时,出现以下错误: [14:51:31] I/hosted – Using the selenium server at (my url here) [14:51:31] I/launcher – Running 1 instances of WebDriver [14:51:51] E/launcher – null [14:51:51] E/launcher – WebDriverError: null at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5) at Object.checkLegacyResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:639:15) at parseHttpResponse (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:538:13) at client_.send.then.response (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/http/index.js:472:11) at ManagedPromise.invokeCallback_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:1379:14) at TaskQueue.execute_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2913:14) at TaskQueue.executeNext_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2896:21) at […]

在执行剩下的testing时保持nodeJs服务器运行

im新nodeJS和webdriveIO编写一些webdriveIOtesting我有两个函数:smsServer(); 和startTest(); 1- smsServer(); function smsServer(){ // parse application/x-www-form-urlencoded app.use(bodyParser.urlencoded({ extended: false })) // parse application/json app.use(bodyParser.json()) app.get('/',function(req,res){ console.log(req.query.text); }); app.post('/', function(req,res){ console.log("Post"); console.log(req.body); res.sendStatus(200); }); app.listen(3000, function(req, res){ console.log('App listening on localhost:3000'); console.log("req: ",req); console.log("res: ",res); }); } 2- startTest(); just some Test WDIO 我想保持我的服务器运行接收一些validation码,而第二个function(testing)执行任何帮助将升值之前,我的老板杀了我

获取浏览器的当前url

在Selenium Nodejs中,我如何获取正在testing的页面的当前url(testing脚本正在运行的那一刻,假设网页最初已被redirect)

为什么Chrome试图在Selenium下运行Chromedriver时无法启动?

所以我有一个Chromedriver /selenium设置工作之前,但现在试图安装在一台新的机器上(64Bit Linux)的一切,它给我的问题,并没有告诉我什么是绊倒。 我正在使用Selenium独立服务器版本2.37.0和nodejs以及Google上现有的最新版本的Chromedriver(我也尝试过之前版本的Chromedriver 2.0,结果相同)。 如下面的输出所示,当我尝试使用webdriver运行脚本时,出现以下错误: Caused by: org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally 。 我没有从chromedriver输出日志,只输出Selenium(带有错误)和Node.js(尝试运行testing脚本)。 任何人都可以给我一个我在做什么错误的想法吗? 编辑:我忘了补充说,在失败后有一个与Chromedriver运行的过程,所以这一块是好的,我的Chrome可执行文件确实在像Chromedriver希望它是在/ etc / bin /谷歌铬。 Output: 一旦我开始selenium运行,我试图运行一个简单的testing脚本的内容: var webdriverjs = require("webdriverjs"); var client = webdriverjs.remote({desiredCapabilities:{browserName:"chrome"}}); // to run in chrome client .init() .url("https://github.com/") .end(); 运行testing脚本的Node.js控制台输出如下所示: [1;33m=====================================================================================[0m Selenium 2.0/webdriver protocol bindings implementation with helper commands in […]

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

如何使用WebdriverIO上传文件

我试图从WebdriverIO中将以下代码从selenium-webdriver gem移植到Node.js中: @webdriver.navigate.to "https://imgur.com/upload" element = @webdriver.find_element(:id, 'global-files-button') element.send_keys("C:\\test\\image.png") 正如你所看到的代码非常简单:导航到一个URL,findinput,设置文件path,并按预期工作selectfile upload。 这是我移植的版本: describe('User can upload', () => { it('select file', () => { browser.url("https://imgur.com/upload"); browser.waitForExist('#global-files-button'); $('#global-files-button').keys("C : \\ test \\ image . png".split(" ")); }); }); 不幸的是,这个testing没有设置path,我一直无法find一个像这样用wdio上传文件的工作示例,文档让我猜测。 任何build议非常感谢。 我知道都select文件和uploadFile,但我正在与云平台运行我的wdiotesting,他们似乎并不可靠的工作。

在节点javascript中使用selenium-webdriver执行“命令”

我有兴趣通过JavaScript API https://code.google.com/p/selenium/source/browse/javascript/webdriver/command.js执行一些高级“命令” 如果我从基本代码开始: var browser = new webdriver .Builder() .usingServer(server.address()) .withCapabilities(webdriver.Capabilities.phantomjs()) .build(); 我尝试执行的每种“可能”语法都失败了。 例如: // does not work console.log(webdriver.Command('getWindowSize')) // does not work console.log(browser.Command('getWindowSize')) 有谁知道如何执行“获取窗口大小”,或“设置窗口大小”在selenium JavaScript的WebDriver?

使用BrowserMobProxyconfigurationWebDriverIO

有没有人有一个正确的例子如何configurationWebDriverIO BrowserMobProxy ? 这是我可以捕捉networkingstream量。 我以前曾经使用过WebDriverJS ,而WebDriverJS本质上是WebDriverIO的弃用版本。