WWW-Mechanize-PhantomJS

 view release on metacpan or  search on metacpan

lib/WWW/Mechanize/PhantomJS/ghostdriver/request_handlers/session_manager_request_handler.js  view on Meta::CPAN

            return _sessionRHs[sessionId];
        }
        return null;
    },

    _cleanupWindowlessSessions = function() {
        var sId;

        // Do this cleanup only if there are sessions
        if (Object.keys(_sessions).length > 0) {
            _log.info("_cleanupWindowlessSessions", "Asynchronous Sessions clean-up phase starting NOW");
            for (sId in _sessions) {
                if (_sessions[sId].getWindowsCount() === 0) {
                    _deleteSession(sId);
                    _log.info("_cleanupWindowlessSessions", "Deleted Session '"+sId+"', because windowless");
                }
            }
        }
    };

    // Regularly cleanup un-used sessions

lib/WWW/Mechanize/PhantomJS/ghostdriver/third_party/webdriver-atoms/execute_async_script.js  view on Meta::CPAN

(function(){var a=Error;function b(){}b.prototype=a.prototype;p.c=a.prototype;p.prototype=new b;p.prototype.constructor=p;p.b=function(b,d,h){for(var f=Array(arguments.length-2),k=2;k<arguments.length;k++)f[k-2]=arguments[k];return a.prototype[d].app...
r[52]="invalid selector";r[17]="javascript error";r[405]="unsupported operation";r[34]="move target out of bounds";r[27]="no such alert";r[7]="no such element";r[8]="no such frame";r[23]="no such window";r[28]="script timeout";r[33]="session not crea...
function w(a,b){for(var c=0,d=v(String(a)).split("."),h=v(String(b)).split("."),f=Math.max(d.length,h.length),k=0;0==c&&k<f;k++){var x=d[k]||"",l=h[k]||"",F=RegExp("(\\d*)(\\D*)","g"),G=RegExp("(\\d*)(\\D*)","g");do{var u=F.exec(x)||["","",""],q=G.ex...
var L=function(){if(ga&&e.opera){var a;var b=e.opera.version;try{a=b()}catch(c){a=b}return a}a="";(b=ja())&&(a=b?b[1]:"");return J&&(b=ka(),null!=b&&b>parseFloat(a))?String(b):a}(),M={},la=e.document,ma=la&&J?ka()||("CSS1Compat"==la.compatMode?parseI...
if(N){var va=/Android\s+([0-9\.]+)/.exec(A);S=va?va[1]:"0"}else S="0";var ua=S;N&&Q(2.3);N&&Q(4);ra&&Q(6);function wa(){}
function T(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if("array"==g(b)){var d=b;b=d.length;c.push("[");for(var h="",f=0;f<b;f++)c.push(h),T(a,d[f],c),h=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof...
!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}}var ya={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"...
function xa(a,b){b.push('"',a.replace(za,function(a){var b=ya[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),ya[a]=b);return b}),'"')};ia||K&&(R?P(3.5):J?0<=w(ma,3.5):M[3.5]||(M[3.5]=0<=w(L,3.5)))||J&&(R?P(8):J?w(ma,8):M[8]||(M[8]=0<=w...
function V(a,b){return"array"==g(a)?z(a,function(a){return V(a,b)}):ba(a)?"function"==typeof a?a:D(a,"ELEMENT")?Ba(a.ELEMENT,b):D(a,"WINDOW")?Ba(a.WINDOW,b):ea(a,function(a){return V(a,b)}):a}function Ca(a,b){if("string"==typeof a)try{return new b.Fu...
function Da(a){a=a||document;var b=a.$wdc_;b||(b=a.$wdc_={},b.a=n());b.a||(b.a=n());return b}function Aa(a){var b=Da(a.ownerDocument),c=fa(b,function(b){return b==a});c||(c=":wdc:"+b.a++,b[c]=a);return c}
function Ba(a,b){a=decodeURIComponent(a);var c=b||document,d=Da(c);if(!D(d,a))throw new p(10,"Element does not exist in cache");var h=d[a];if(D(h,"setInterval")){if(h.closed)throw delete d[a],new p(23,"Window has been closed.");return h}for(var f=h;f...
if(l.closed)f("Unable to execute script; the target window is closed.");else{a=Ca(a,l);b=V(b,l.document);b.push(m(k,0));l.addEventListener?l.addEventListener("unload",x,!0):l.attachEvent("onunload",x);var u=n();try{a.apply(l,b),F=l.setTimeout(functio...
for(var Y;W.length&&(Y=W.shift());){var Z;if(Z=!W.length)Z=void 0!==Ea;Z?X[Y]=Ea:X[Y]?X=X[Y]:X=X[Y]={}};; return this._.apply(null,arguments);}.apply({navigator:typeof window!=undefined?window.navigator:null,document:typeof window!=undefined?window.d...

t/50-click.t  view on Meta::CPAN

    if (! $clicked) {
        SKIP: { skip "Couldn't get at 'clicked'. Do you have a Javascript blocker?", 15; };
        return;
    };

    ok $clicked, "We found 'clicked'";

    # Xpath
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ xpath => '//*[@id="a_link"]', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->click() with an xpath selector works";

    # Xpath
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ xpath => '//div[@id="a_div"]', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_div', "->click() with an xpath selector works";

    # CSS
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ selector => '#a_link', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->click() with a CSS selector works";

    # CSS
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ selector => '#a_div', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_div', "->click() with a CSS selector works";

    # id
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ id => 'a_link', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->click() with an id works";

    # id
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ id => 'a_div', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_div', "->click() with an id works";

    # id
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ id => 'foo:fancy', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'foo:fancy', "->click() with an id works";

    # id
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ id => 'foo:array[1]', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'foo:array[1]', "->click() with an id works";

    # by_id
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ by_id => 'a_link', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->click() with by_id works";

    # by_id
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->click({ by_id => 'a_div', synchronize=>0, });
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_div', "->click() with by_id works";

    # Name via options
    $mech->get_local('50-click.html');
    $mech->click({ name => 'Go' }); # click the "Go" button
    like $mech->uri, qr/\bGo=/, "->click() the 'Go' button works via options";

    # Name
    $mech->get_local('50-click.html');

t/50-follow-link.t  view on Meta::CPAN

    if (! $clicked) {
        SKIP: { skip "Couldn't get at 'clicked'. Do you have a Javascript blocker?", 8; };
        return;
    };

    ok $clicked, "We found 'clicked'";

    # Xpath
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->follow_link( xpath => '//*[@id="a_link"]', synchronize=>0, );
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->follow_link() with an xpath selector works";

    # CSS
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->follow_link( selector => '#a_link', synchronize=>0, );
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->follow_link() with a CSS selector works";

    # Regex
    $mech->get_local('50-click.html');
    $mech->allow('javascript' => 1);
    $mech->follow_link( text_regex => qr/A link/, synchronize => 0 );
    ($clicked,$type) = $mech->eval_in_page('clicked');
    is $clicked, 'a_link', "->follow_link() with a RE works";

    # Non-existing link
    $mech->get_local('50-click.html');
    my $lives = eval { $mech->follow_link('foobar'); 1 };
    my $msg = $@;
    ok !$lives, "->follow_link() on non-existing parameter fails correctly";
    like $msg, qr/No elements found for Button with name 'foobar'/,
        "... with the right error message";

t/50-popup.t  view on Meta::CPAN

    ($win, $type) = $mech->eval_in_page('open_window');
    $ok = 1;
};

if (! $win) {
    SKIP: { skip "Couldn't get at 'open_window'. Do you have a Javascript blocker?", 15; };
    exit;
};

ok $win, "We found 'open_window'";
$mech->click($win, synchronize => 0);
ok 1, "We get here";
diag "But we don't know what window was opened";
# or how to close it

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.835 second using v1.00-cache-2.02-grep-82fe00e-cpan-3b7f77b76a6c )