Giter Club home page Giter Club logo

Comments (20)

jprichardson avatar jprichardson commented on May 18, 2024

I thought that modifying min-wd/driver.js/connectBrowser() with capabilities found here: https://code.google.com/p/selenium/wiki/JsonWireProtocol#Desired_Capabilities would help, but it doesn't. Just an FYI.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Another FYI, even with my modification to min-wd capabilities, the output still shows:

Capabilities [{applicationCacheEnabled=false, rotatable=false, chrome={userDataDir=/var/folders/f0/3bf0bqj54fl6b3g0__nymw_m0000gn/T/.org.chromium.Chromium.FCHZKp}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, version=35.0.1916.153, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]

Emphasis mine.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Sorry for blowing up your email here... :p However, it looks like the modification to min-wd module makes Safari at least work for now.

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

Fancy sending a pull request for min-webdriver?

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Sure, but it's still broken for Chrome.

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

If you could make a pull request with the solution for Safari and maybe link a Gist with an example that works there, but fails in Chrome, that would be helpful.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

I was wrong. It sporadically passes in Safari regardless. I was just modifying driver.js:

function connectBrowser(context, callback) {
  var caps = {
    browserName       : context.browser.name,
    version           : context.browser.version,
    platform          : context.browser.platform,
    javascriptEnabled : true
  };

to

function connectBrowser(context, callback) {
  var caps = {
    browserName       : context.browser.name,
    version           : context.browser.version,
    platform          : context.browser.platform,
    javascriptEnabled : true,
    databaseEnabled : true
  };

But it seems no matter what I do, I can't update the capabilities for Selenium. Mochify shows the capabilities through chrome and they're not updated with any change. It's very weird. Here's the relevant part on the POST /session: https://code.google.com/p/selenium/wiki/JsonWireProtocol#/session

I'm really not sure what the problem is. You can easily verify the behavior by installing PouchDB with npm and trying to create a database and then running mochify.

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

The capabilities cannot be forced. If the browser driver does not support the database capability, there is not much you can do.
You can try to put in requiredCapabilities and see whether it fails with a more meaningfull message.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

What's the purpose of selenium offering setting the capabilities if you can't "set" them? To just disable them? I tried requiredCapabilities as well.

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

I think the idea is to have a set of settings that your app can work with, but not all of them might be supported by all devices. Think mobile, for example. It depends on the device / browser driver what it can actually support.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

That makes sense, but you'd think that desktop Chrome would support databaseEnabled especially since the output shows it. I guess maybe a ChromeDriver issue?

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

Looking at the error message, it could also be that Chrome does not allow DB access to injected scripts. Did you try FireFox yet?

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

No, I don't have it on this machine. But I'll install it and try it out. But it doesn't work in Safari either. Googling for selenium indexeddb doesn't yield much, so I must be missing something.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Fails in Firefox too.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Ok, I created a project to reproduce the problem. I'd love to know if you have the same issues:

https://github.com/jprichardson/indexeddb-selenium

Readme contains instructions on reproducing error.

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

I'll have a look later today. Thanks!

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

Thanks again for putting together the repo for reproducing the issue.

The solution to your problem is to configure a "url" to load with an empty HTML page before running the tests (as described here: https://github.com/mantoni/min-webdriver#ie-trouble-shooting).

I don't really know why, but in some cases, browsers behave weird if they run scripts in the default Selenium start page. I will update the documentation accordingly.

Please let me know if there is anything else that is not working for you.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Ok, thanks. By that documentation it's not really clear... should doctype.html just be dropped in the same dir as package.json? Should the url literally be: http://my-server/doctype.html? I tried changing my-server to localhost and couldn't get it to work.

Also, why not just have mochify do this by default every single run-time?

from mochify.js.

mantoni avatar mantoni commented on May 18, 2024

I've updated the documentation with some additional explanation. You will need to wip up a static file server that ships the html page at some URL. It can totally be localhost and some node service or an Apache or whatever works best for you.

This could be done by Mochify, yes, but it would only solve the issue when running Selenium locally.
For me, a central static file server with a URL that can be reached from the entire network (or even the internet) works better because I'm running tests on multiple remote machines and on SauceLabs for my open source projects. Also, not all the projects actually need this hack.

For SauceLabs, I heard of an option to tunnel traffic back to a dev machine. For custom Selenium Grid setups, one would have to make sure the machine running the tests is accessible from the clients and pass down the URL.

If you have a good idea on how to make the setup easier, ideas and pull requests are very welcome.

from mochify.js.

jprichardson avatar jprichardson commented on May 18, 2024

Thanks for your help on this and for Mochify. I love this module. I created a local server and piped the file. It's working great; you can see a super simple example of it where I needed it: https://github.com/jprichardson/browser-storage specifically in test/dev-server/.

If I think of a clever way that this can be automated, I'll submit a PR. Thanks again!

from mochify.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.