Giter Site home page Giter Site logo

auquery's People

Contributors

cyrjano avatar opichals avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

opichals

auquery's Issues

broweser.moveTo method does not work according to specification

Following code does not work:

var lib = require('auQuery');
var wd = require('wd');
var assert = require('assert');
var Browser = lib.browser;
var AuQuery = lib.auQuery;

var webDriver = wd.remote();

var browser = new Browser(webDriver);

browser.drive(function($, browser){
        browser.init({browserName:'chrome'});
        browser.get('http://www.bing.com');
        var searchBox = browser.elementById('sb_form_q');
        searchBox.type('GoodData');
        var searchButton = browser.elementById('sb_form_go');
        console.log(searchButton.value);
        browser.moveTo(searchButton, 0, 0);
        browser.click();
    }
    , function(err, res){
        if(err){
            console.log(err);
        }
    });

The reason is that moveTo method is wrapped in the sync version only at the beginning during init. But it needs to know the element.value for successful moveTo operation.

When elementById response arrives the sync wrapper does not find moveTo in the object so it does not create appropriate closure and moveTo fails with:

17:11:14.098 INFO - Executing: [mousemove: [object Object] true] at URL: /session/d03286e2-8d4f-46df-b6bb-a89cd01b65c4/moveto)
17:11:14.098 WARN - Exception thrown
java.lang.NullPointerException
    at org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation.call(MouseMoveToLocation.java:51)
    at org.openqa.selenium.remote.server.handler.interactions.MouseMoveToLocation.call(MouseMoveToLocation.java:1)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:680)
17:11:14.099 WARN - Exception: null

because it does not receive appropriate element id from auQuery.

Currently, I do not know how to fix this? How can we reach the moveTo after parsing the findElement' response?

Support for waitForElement() patch

I have added a fn.wait() method which calls browser.waitForElement() method to ensure it is already available.

Further I monkey patched the fn.init() method to ensure to call the .wait() method before construction of the $() instance.

I can see this .wait() called from within the .init() as an option that could be switched via an option to the browser.drive() method. Or simply having it there by default.

If this is something you would consider a good idea I would however appreciate help with integrating into the source code. Here is a gist of my patch code https://gist.github.com/opichals/5916347

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.