Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Object true has no method 'substring' when using .waitFor() with firefox #15

Open
jedix opened this issue Nov 21, 2014 · 1 comment
Assignees
Labels

Comments

@jedix
Copy link

jedix commented Nov 21, 2014

Hi,

I just wanted to open a Youtube video with dalek-browser-firefox, but to be able to watch it to the end, I need .waitFor(). If I use it, the following happens:

Command with output:

dalek -b firefox youtube.js
Running tests
☁ [SYSTEM] dalek-internal-driver: Loading driver: "native"
Running Browser: Mozilla Firefox
☁ [WEBDRIVER] webdriver: 200 POST /session
☁ [WEBDRIVER] webdriver:
☁ [WEBDRIVER] webdriver: 200 POST /session/12/window/current/size
☁ [WEBDRIVER] webdriver: {"sessionId":"12","status":0,"value":true}
☁ [WEBDRIVER] webdriver: 200 GET /status
☁ [WEBDRIVER] webdriver: {"from":"0","value":{"os":{"arch":"x86_64","name":"Darwin","version":"unknown"},"build":{"revision":"unknown","time":"20140127194636","version":"27.0"}}}
OS: Darwin unknown x86_64
☁ [WEBDRIVER] webdriver: 200 GET /session/12
☁ [WEBDRIVER] webdriver: {"sessionId":"12","status":0,"value":{"appBuildId":"20140127194636","XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","cssSelectorsEnabled":true,"browserName":"Firefox","handlesAlerts":false,"javascriptEnabled":true,"nativeEvents":false,"platform":"Darwin","device":"desktop","rotatable":false,"takesScreenshot":false,"version":"27.0"}}
Browser Version: 27.0

RUNNING TEST - "Video-Test"
☁ [WEBDRIVER] webdriver: 200 POST /session/11/url
☁ [WEBDRIVER] webdriver: {"sessionId":"11","status":0}
▶ OPEN http://www.youtube.com/watch?v=s_Dt-Cny3dY
TypeError: Object true has no method 'substring'
    at null.<anonymous> (/development/dalek/node_modules/dalek-browser-firefox/lib/marionette.js:214:52)
    at Array.forEach (native)
 + n/d/l/marionette.js
    at null.<anonymous> (/development/dalek/node_modules/dalek-browser-firefox/lib/marionette.js:213:32)
    at Array.forEach (native)
    at Marionette._parseRequestKey (/development/dalek/node_modules/dalek-browser-firefox/lib/marionette.js:212:25)
    at null.<anonymous> (/development/dalek/node_modules/dalek-browser-firefox/lib/marionette.js:144:25)
    at Array.forEach (native)
    at null.<anonymous> (/development/dalek/node_modules/dalek-browser-firefox/lib/marionette.js:131:34)
    at EventEmitter.emit (events.js:95:17)
    at Driver.addCommand.onRequest (/development/dalek/node_modules/dalek-browser-firefox/lib/commands/webdriver/execute.js:60:19)
    at callbacks (/development/dalek/node_modulesdalek-browser-firefox/node_modules/express/lib/router/index.js:164:37)
    at param (/development/dalek/node_modules/dalek-browser-firefox/node_modules/express/lib/router/index.js:138:11)
    at param (/development/dalek/node_modules/dalek-browser-firefox/node_modules/express/lib/router/index.js:135:11)
    at pass (/development/dalek/node_modules/dalek-browser-firefox/node_modules/express/lib/router/index.js:145:5)
    at Router._dispatch (/development/dalek/node_modules/dalek-browser-firefox/node_modules/express/lib/router/index.js:173:5)
    at Object.router (/development/dalek/node_modules/dalek-browser-firefox/node_modules/express/lib/router/index.js:33:10)
    at next (/development/dalek/node_modules/dalek-browser-firefox/node_modules/connect/lib/proto.js:193:15)
    at Object.urlencoded [as handle] (/development/dalek/node_modules/connect/lib/middleware/urlencoded.js:37:27)
    at next (/development/dalek/node_modules/dalek-browser-firefox/node_modules/connect/lib/proto.js:193:15)
    at /development/dalek/node_modules/dalek-browser-firefox/node_modules/connect/lib/middleware/json.js:81:7
    at IncomingMessage.onEnd (/development/dalek/node_modules/dalek-browser-firefox/node_modules/connect/node_modules/raw-body/index.js:113:7)
    at IncomingMessage.g (events.js:180:16)
    at IncomingMessage.emit (events.js:92:17)
    at _stream_readable.js:943:16
    at process._tickCallback (node.js:419:13)

youtube.js

module.exports = {
    'Video-Test': function (test) {
        test
            .open('http://www.youtube.com/watch?v=s_Dt-Cny3dY')
            .waitFor(function(){
                return Boolean(document.querySelector('#share-services-container'));
            }, [], 10000)
            .done();
    }
}

Dalekfile.json

{
    "logLevel": 5,
    "browsers": [{
         "firefox": {
            "binary": "/development/tcp-analysis/python-client/dalek/Firefox-27.app/Contents/MacOS/firefox"
         }
     }]
}

After removing .waitFor(function() { [...] }) from the test, everything works:

dalek -b firefox youtube.js
Running tests
☁ [SYSTEM] dalek-internal-driver: Loading driver: "native"
Running Browser: Mozilla Firefox
☁ [WEBDRIVER] webdriver: 200 POST /session
☁ [WEBDRIVER] webdriver:
☁ [WEBDRIVER] webdriver: 200 POST /session/12/window/current/size
☁ [WEBDRIVER] webdriver: {"sessionId":"12","status":0,"value":true}
☁ [WEBDRIVER] webdriver: 200 GET /status
☁ [WEBDRIVER] webdriver: {"from":"0","value":{"os":{"arch":"x86_64","name":"Darwin","version":"unknown"},"build":{"revision":"unknown","time":"20140127194636","version":"27.0"}}}
OS: Darwin unknown x86_64
☁ [WEBDRIVER] webdriver: 200 GET /session/12
☁ [WEBDRIVER] webdriver: {"sessionId":"12","status":0,"value":{"appBuildId":"20140127194636","XULappId":"{ec8030f7-c20a-464f-9b0e-13a3a9e97384}","cssSelectorsEnabled":true,"browserName":"Firefox","handlesAlerts":false,"javascriptEnabled":true,"nativeEvents":false,"platform":"Darwin","device":"desktop","rotatable":false,"takesScreenshot":false,"version":"27.0"}}
Browser Version: 27.0

RUNNING TEST - "Video-Test"
☁ [WEBDRIVER] webdriver: 200 POST /session/12/url
☁ [WEBDRIVER] webdriver: {"sessionId":"12","status":0}
▶ OPEN http://www.youtube.com/watch?v=s_Dt-Cny3dY
✔ 0 Assertions run
✔ TEST - "Video-Test" SUCCEEDED

 0/0 assertions passed. Elapsed Time: 1.87 sec

I'm running OS X 10.1,
DalekJS CLI Tools Version: 0.0.4,
DalekJS local install: 0.0.8,
dalek-browser-firefox: 0.0.6,
Firefox: 27.0

With the current Firefox version, dalek does not work at all:

net.js:1236
    throw new Error('Not running');
          ^

But I'm happy with 27, so the first issue would be the important one.

Regards,
Jens

@asciidisco asciidisco added the bug label Dec 3, 2014
@asciidisco
Copy link
Member

The Problem is, that the Mozilla Marionette Team changes their testing APIs (they are not using Webdriver) with nearly every Build of Firefox. I kinda gave up on reimplementing them & instead started a new generic proojekt that is a webdriver impl. for Firefox that is not related to Dalek, but will be used by Dalek in the future, see: firefoxdriver

TL:DR; It is a bug in the current implementation and will be resolbved once we upgraded to firefoxdriver

@asciidisco asciidisco self-assigned this Dec 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants