File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -241,7 +241,10 @@ $.visit('https://www.google.com', function(){
241241
242242 - site: (string, default='') - A base url for the site so that all other 'visit' calls could be relative.
243243 - addJQuery: (boolean, default=TRUE) - TRUE if you need to add jQuery to the page you are visiting, FALSE if the page already adds jQuery.
244- - jQuery: (string, default='http://code.jquery.com/jquery-1.9.1.min.js ') - The CDN url of the jQuery to add to the page if addJQuery is set to TRUE.
244+ - jQuery: (string, default='http://code.jquery.com/jquery-1.11.1.min.js ') - The CDN url of the jQuery to add to the page if addJQuery is set to TRUE.
245+ - width: (int, default=1920) - The width of the viewport
246+ - height: (int, default=1080) - The height of the viewport
247+ - userAgent: (string, defaults to phantoms agent) - Set a custom user agent
245248
246249``` javascript
247250var $ = require (' jquerygo' );
Original file line number Diff line number Diff line change @@ -365,6 +365,14 @@ var jQuery = _.extend(function(selector, context) {
365365 } ) ;
366366 }
367367
368+ // Set a custom user agent if it hasn't already been set.
369+ if ( self . config . userAgent && ! self . userAgentSet ) {
370+ self . userAgentSet = true ;
371+ page . set ( 'settings.userAgent' , self . config . userAgent , function ( result ) {
372+ self . debug ( "Useragent set to: " + result ) ;
373+ } ) ;
374+ }
375+
368376 // Open the page.
369377 self . debug ( 'Navigating to ' + self . config . site + url ) ;
370378 page . open ( self . config . site + url , function ( status ) {
You can’t perform that action at this time.
0 commit comments