learnboost / soda Goto Github PK
View Code? Open in Web Editor NEWSelenium Node.JS adapter
Home Page: http://labs.learnboost.com
Selenium Node.JS adapter
Home Page: http://labs.learnboost.com
selectAndWait is a valid selenium command. I have added it to my local copy and it works fine.
Thank You
how do I transfer document html/elements html to use inside nodejs?
(ie from browser/selenium to nodejs variables).
i've tried using browser.storeHtmlSource(x).end()
but if x is not defined in nodejs it throws an exception.
and if x is defined, it's value isn't changed.
i get in every test with the getTitle function this error:
markus-imac:saucelabs markus$ node example-test.js
getNewBrowserSession: {"url":"http://example.saucelabs.com/","username":"*******","access-key":"*********","os":"Windows 2003","browser":"firefox","browser-version":"7","name":"This is an example test"}, http://example.saucelabs.com/
open: /
getTitle:
/Users/markus/saucelabs/example-test.js:27
if (err) throw err;
^
AssertionError: Title did not include the query
at /Users/markus/saucelabs/example-test.js:23:12
at /Users/markus/node_modules/soda/lib/soda/client.js:219:11
at IncomingMessage. (/Users/markus/node_modules/soda/lib/soda/client.js:126:9)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Client.onData as ondata
at Client._onReadable (net.js:683:27)
at IOWatcher.onReadable as callback
markus-imac:saucelabs markus$
if i log title in the getTitle function i get: "The command you just sent (getTitle) included a bad session ID. Usually this is due to an ignored error message in an earlier command."
https://github.com/detro/ghostdriver
It would be great if we can power phantomjs via selenium/soda for both our continuous integration environments and local developer machines. Is it likely to be added to the list of browsers supported at any point?
Node is giving me this warning in the console when running a soda 0.2.5 test.
I'm using the latest node 0.8.x. Running the saucelabs soda example.
Can you help in below soda query
sometimes they work fine with css etc, some times they dont, might just be me being tired :)
I am trying to use assertTextNotPresent command which is listed in soda js files but it is not supporting...
If the remote Selenium server is not up ECONNREFUSED gets thrown and terminates the entire process.
Please do something similar to:
http://rentzsch.tumblr.com/post/664884799/node-js-handling-refused-http-client-connections
I'd fork & pull request myself BUT not sure how you want to handle the error... thanks!! Mark
Hey,
changing the browser option from "_firefox" to "_googlechrome" brings up chrome, but doesn't run the commands and throws the following error:
"error(1320828907344): isNewPageLoaded found an old pageLoadError: TypeError: Cannot call method 'indexOf' of undefined"
I found on the selenium mailing list, that this is "only" a security issue - chrome blocks cross domain interactions. This can be deactivated by setting a command line flag ("--disable-web-security").
But, where can I set it using soda? Is there any field in the options object?
Thanks!
BTW:
Here is the link to the discussion on the mailing list:
http://groups.google.com/group/selenium-users/browse_thread/thread/d9fd7cfce23351c4/d45c990ee56b8f37?lnk=gst&q=isNewPageLoaded+found+an+old+pageLoadError%3A+TypeError%3A+Cannot+call+method+%27indexOf%27+of+undefined#d45c990ee56b8f37
seems to be messing up, try with the header
Hi.
I wonder when Soda will support Selenium 2.
I am trying to add a Location Strategy by chaining the following method after the browser has been already loaded:
https://gist.github.com/898157
but it looks like this method has no effect and no Location Strategy is registered in Selenium. Should be done in a different way? How can I add location strategies with Soda?
Thanks
currently you must supply the callback
from client for debugging etc
When my tests fail, the browser window it ran in doesn't close. What could I be doing wrong?
I think it might have something to do with the fact that the 'testComplete' method doesn't work for me as it is presented in the documentation.
The documentation suggests that I use it like this:
browser
.chain
.session()
.open('/')
.end(function(err){
browser.testComplete(function() {
if(err) throw err;
done()
});
});
The 'done' callback in the previous code never gets called and my test never knows that it was completed.
This is what I currently use:
browser
.chain
.session()
.open('/')
.testComplete()
.end(function(err){
if(err) throw err;
done();
});
Any tips?
So there's no continue pop-up ?
Does .break() not function in webdriver/selenium 2.0 ?
I get error msq
Error: break(): Unknown command: 'break'
Thanks.
My environment contains browser names, that don't start with * like "Firefox on Windows", so i had to comment out this.browser = '*' + this.browser; so that soda.js could connect to them
Current npm-published version yields warnings when running, due to deprecated api.
This is fixed in the master-branch, so a version bump + npm publish would generate happiness :)
All the fields with api info on the page are display:none and i can't read them without manually going into dev tools and resetting that stuff.
I tried on Chrome and Firefox happens on both.
Maybe this doesn't belong in the library itself, but is there any way to limit the number of concurrent browser sessions when running the tests locally? I'm running the tests using expresso (https://github.com/nshah/rell/blob/master/tests.js), but each test I add ends up creating a new browser instance in parallel. If such a feature doesn't exist, would you guys be open to a patch?
This isn't being maintained now, may aswell point users to something like https://github.com/admc/wd
Hi,
I haven't found a documented way to use the sendKeys selenium command in Soda. Is there a way?
It doesn't appear that 0.2.5 has been published to npm. Any chance you guys could do that so we could get the new lovin' goodness that Santi has added? We are huge fans of soda and having so much fun with it!
Thanks!
I'm an trying to set up automated testing for a node app using jade as the templating engine. However, when i attempt to open one of the pages the dev console logs
jQuery is not defined, because the jQuery script isn't loaded. The network bar shows the scripts are not loaded. Multiple page refreshes also do not solve the issue, along with simply waiting on the page. This issue seems to only arise for a few non-locally hosted scripts. On static pages this issue doesn't arise.
Code:
var soda = require('soda')
, assert = require('assert');
var browser = soda.createClient({
url: 'http://localhost:8000'
,browser:'googlechrome'
});
browser.on('command', function(cmd, args){
console.log(' \x1b[33m%s\x1b[0m: %s', cmd, args.join(', '));
});
browser
.chain
.session()
.open('/')
.waitForCondition('false',50000)
.end(function(err){
browser.testComplete(function(){
console.log('done');
if(err) throw err;
});
});
It's still showing up in Google search results, but this link goes to a parked domain: http://sodajs.com/api.html
Hi,
I can't seem to run the example in the current version of Soda.
$ node google.js
getNewBrowserSession: *firefox, http://www.google.com
open: /
type: q, Hello World
clickAndWait: btnG
/home/user/node_modules/soda/examples/google.js:35
if (err) throw err;
^
Error: clickAndWait(btnG): Timed out after 30000ms
at IncomingMessage.<anonymous> (/home/user/node_modules/soda/lib/soda/client.js:122:12)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Client.onData [as ondata] (http.js:1509:27)
at Client._onReadable (net.js:682:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)
Here's the Selenium (latest version from their website) output of the jar
$ java -jar selenium-server-standalone-2.0.0.jar
Jul 7, 2011 9:46:29 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
21:46:29.476 INFO - Java: Sun Microsystems Inc. 19.0-b09
21:46:29.477 INFO - OS: Linux 2.6.35-25-virtual i386
21:46:29.487 INFO - v2.0.0, with Core v2.0.0. Built from revision 12817
21:46:29.600 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
21:46:29.601 INFO - Version Jetty/5.1.x
21:46:29.601 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
21:46:29.602 INFO - Started HttpContext[/selenium-server,/selenium-server]
21:46:29.602 INFO - Started HttpContext[/,/]
21:46:29.619 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@d1e89e
21:46:29.619 INFO - Started HttpContext[/wd,/wd]
21:46:29.623 INFO - Started SocketListener on 0.0.0.0:4444
21:46:29.623 INFO - Started org.openqa.jetty.jetty.Server@1b1aa65
21:46:35.509 INFO - Checking Resource aliases
21:46:35.510 INFO - Command request: getNewBrowserSession[*firefox, http://www.google.com] on session null
21:46:35.512 INFO - creating new remote session
21:46:35.544 INFO - Allocated session c5ff0aa876664c9caefbebd877ac4455 for http://www.google.com, launching...
21:46:35.586 INFO - Preparing Firefox profile...
21:46:38.037 INFO - Launching Firefox...
21:46:40.572 INFO - Got result: OK,c5ff0aa876664c9caefbebd877ac4455 on session c5ff0aa876664c9caefbebd877ac4455
21:46:40.584 INFO - Command request: open[/, ] on session c5ff0aa876664c9caefbebd877ac4455
21:46:40.901 INFO - Got result: OK on session c5ff0aa876664c9caefbebd877ac4455
21:46:40.905 INFO - Command request: type[q, Hello World] on session c5ff0aa876664c9caefbebd877ac4455
21:46:40.943 INFO - Got result: OK on session c5ff0aa876664c9caefbebd877ac4455
21:46:40.946 INFO - Command request: clickAndWait[btnG, ] on session c5ff0aa876664c9caefbebd877ac4455
21:47:10.981 INFO - Got result: Timed out after 30000ms on session c5ff0aa876664c9caefbebd877ac4455
Any help would be appreciated.
thanks!
How can I configure it to run from behind a proxy?
Error output below:
user@~/apps/npm.git $ npm install soda
npm info it worked if it ends with ok
npm info version 0.2.0
npm info fetch http://registry.npmjs.org/soda/-/soda-0.0.2.tgz
npm ERR! Error installing [email protected]
npm ERR! Error: Failed to create /usr/local/lib/node/.npm/.cache/soda/0.0.2/package.tgz: ENOENT, No such file or directory '/usr/local/lib/node/.npm/.cache/soda/0.0.2/package.tgz'
npm ERR! at /usr/local/lib/node/.npm/npm/0.2.0/package/lib/utils/fetch.js:23:25
npm ERR! at cb (/usr/local/lib/node/.npm/npm/0.2.0/package/lib/utils/graceful-fs.js:28:9)
npm ERR! at node.js:759:9
npm ERR! try running: 'npm help install'
npm ERR! Report this entire log at http://github.com/isaacs/npm/issues
npm ERR! or email it to [email protected]
npm not ok
Is it possible to run all tests inside particular category?
in Selenium RC Example, this line
.clickAndWait('btnG')
doesn't really receive a newPageLoaded flag from current google search,
maybe it should be changed to
.click('btnG')
.waitForElementPresent( 'foot' )
instead!
Is there anyway to get the statusCode of the current page?
I thought that you could do something like this
var client = require('soda').createClient({
host: 'localhost',
port: 4444,
url: 'http://return500',
browser: 'firefox'
});
client
.chain
.session()
.open('http://return500', function(body, res) {
assert.equal(500, res.statusCode);
})
.end();
but alas, res.statusCode
seems to be between the client and Selenium server (i think?)... not the HTTP returned from the actual browser page...
any help would be appreciated.
(note, soda might not even return this information, if anyone knows if it's a definitive no, please let me know, and I'll stop searching...)
Thanks! :)
Is there a way to delete session cookies?
I've tried .deleteAllVisibleCookies()
but it doesn't seem to delete session cookies (Express).
In fact I'm not sure if I can even retrieve the session cookie.
.getCookie()
doesn't show connect.sid
.deleteCookie('connect.sid', 'domain=localhost, path=/)
doesn't work
Oh it's an httpOnly cookie... anyway to remove it still?
client.chain.session()
.open('http://google.com')
.getEval('alert("hi")')
.end();
the alert("hi")
runs in the Selenium RC window, not the actual browser subject window (http://google.com)...
I want to run our qunit tests in different browsers using selenium/soda and capture screenshots of failed tests.
function runTestsInBrowser(browserName){
var browser = soda.createClient({
host: 'localhost'
, port: 4444
, url: 'http://localhost'
, browser: browserName
});
browser
.chain
.session()
.open('/testpage.html')
.waitForTextPresent('Tests completed')
.assertTextPresent('0 failed')
.end(function(err){
browser.testComplete(function(){
console.log('done');
if (err){
var timestamp = (new Date).toISOString().split(':').join('-').split('.')[0];
browser.captureEntirePageScreenshot('D:\\dev\\selenium\\screenshots\\' + browserName + '_' + timestamp + '.png');
//throw err;
}
});
});
}
runTestsInBrowser('firefoxchrome');
//runTestsInBrowser('iexplore');
runTestsInBrowser('chrome');
unfortunately, this leads to an exception:
D:\dev\selenium\soda\lib\soda\client.js:122
fn(new Error(err), res.body, res);
^
TypeError: string is not a function
at IncomingMessage.<anonymous> (D:\dev\selenium\soda\lib\soda\client.js:122:
9)
at IncomingMessage.EventEmitter.emit (events.js:117:20)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
turns out that the screenshot file path was assigned to fn. am i doing something wrong?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.