selenium-webdriver 3.4.4 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,19 @@
1
+ 3.5.0 (2017-08-10)
2
+ ==================
3
+
4
+ Firefox:
5
+ * Firefox subprocess output is now only redirected when debug is set (issue #4311)
6
+ * Fixed a bug where non-integers could be sent when setting window rect
7
+ * Fixed Firefox location detection on Windows_x64 (thanks kamenlitchev)
8
+ * Fixed passing of profile with a W3C compatible remote end
9
+
10
+ IE:
11
+ * Added new IE::Options class that should be used to customize browser
12
+ behavior (native events, element scroll behavior, etc).
13
+ The instance of options class can be passed to driver initialization using
14
+ :options key. Old way of passing these customization directly to driver
15
+ initialization is deprecated.
16
+
1
17
  3.4.4 (2017-07-13)
2
18
  ==================
3
19
 
@@ -1,11 +1,8 @@
1
- function(){return function(){var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){if(b.get||b.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this;
2
- function e(a,c){if(c){for(var b=ba,d=a.split("."),f=0;f<d.length-1;f++){var h=d[f];h in b||(b[h]={});b=b[h]}d=d[d.length-1];f=b[d];h=c(f);h!=f&&null!=h&&aa(b,d,{configurable:!0,writable:!0,value:h})}}
3
- e("String.prototype.repeat",function(a){return a?a:function(a){var b;if(null==this)throw new TypeError("The 'this' value for String.prototype.repeat must not be null or undefined");b=this+"";if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var d="";a;)if(a&1&&(d+=b),a>>>=1)b+=b;return d}});e("Math.sign",function(a){return a?a:function(a){a=Number(a);return!a||isNaN(a)?a:0<a?1:-1}});var g=this;function l(a){return"string"==typeof a};function m(a,c){this.a=n[a]||p;this.message=c||"";var b=this.a.replace(/((?:^|\s+)[a-z])/g,function(a){return a.toUpperCase().replace(/^[\s\xa0]+/g,"")}),d=b.length-5;if(0>d||b.indexOf("Error",d)!=d)b+="Error";this.name=b;b=Error(this.message);b.name=this.name;this.stack=b.stack||""}
4
- (function(){var a=Error;function c(){}c.prototype=a.prototype;m.b=a.prototype;m.prototype=new c;m.prototype.constructor=m;m.a=function(b,c,f){for(var h=Array(arguments.length-2),k=2;k<arguments.length;k++)h[k-2]=arguments[k];return a.prototype[c].apply(b,h)}})();var p="unknown error",n={15:"element not selectable",11:"element not visible"};n[31]=p;n[30]=p;n[24]="invalid cookie domain";n[29]="invalid element coordinates";n[12]="invalid element state";n[32]="invalid selector";n[51]="invalid selector";
5
- n[52]="invalid selector";n[17]="javascript error";n[405]="unsupported operation";n[34]="move target out of bounds";n[27]="no such alert";n[7]="no such element";n[8]="no such frame";n[23]="no such window";n[28]="script timeout";n[33]="session not created";n[10]="stale element reference";n[21]="timeout";n[25]="unable to set cookie";n[26]="unexpected alert open";n[13]=p;n[9]="unknown command";m.prototype.toString=function(){return this.name+": "+this.message};var q=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};
6
- function r(a,c){for(var b=0,d=q(String(a)).split("."),f=q(String(c)).split("."),h=Math.max(d.length,f.length),k=0;!b&&k<h;k++){var S=d[k]||"",ja=f[k]||"",ka=RegExp("(\\d*)(\\D*)","g"),la=RegExp("(\\d*)(\\D*)","g");do{var t=ka.exec(S)||["","",""],u=la.exec(ja)||["","",""];if(0==t[0].length&&0==u[0].length)break;b=v(0==t[1].length?0:parseInt(t[1],10),0==u[1].length?0:parseInt(u[1],10))||v(0==t[2].length,0==u[2].length)||v(t[2],u[2])}while(!b)}return b}function v(a,c){return a<c?-1:a>c?1:0};var w;a:{var x=g.navigator;if(x){var y=x.userAgent;if(y){w=y;break a}}w=""}function z(a){return-1!=w.indexOf(a)};function ca(a,c){for(var b=a.length,d=l(a)?a.split(""):a,f=0;f<b;f++)f in d&&c.call(void 0,d[f],f,a)};function A(){return z("iPhone")&&!z("iPod")&&!z("iPad")};function B(){return z("Opera")||z("OPR")}function C(){return(z("Chrome")||z("CriOS"))&&!B()&&!z("Edge")};var D=B(),E=z("Trident")||z("MSIE"),F=z("Edge"),G=z("Gecko")&&!(-1!=w.toLowerCase().indexOf("webkit")&&!z("Edge"))&&!(z("Trident")||z("MSIE"))&&!z("Edge"),da=-1!=w.toLowerCase().indexOf("webkit")&&!z("Edge");function ea(){var a=w;if(G)return/rv\:([^\);]+)(\)|;)/.exec(a);if(F)return/Edge\/([\d\.]+)/.exec(a);if(E)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(da)return/WebKit\/(\S+)/.exec(a)}function H(){var a=g.document;return a?a.documentMode:void 0}
7
- var I=function(){if(D&&g.opera){var a;var c=g.opera.version;try{a=c()}catch(b){a=c}return a}a="";(c=ea())&&(a=c?c[1]:"");return E&&(c=H(),null!=c&&c>parseFloat(a))?String(c):a}(),J={},K=g.document,L=K&&E?H()||("CSS1Compat"==K.compatMode?parseInt(I,10):5):void 0;!G&&!E||E&&9<=Number(L)||G&&(J["1.9.1"]||(J["1.9.1"]=0<=r(I,"1.9.1")));E&&(J["9"]||(J["9"]=0<=r(I,"9")));var fa=z("Firefox"),ga=A()||z("iPod"),ha=z("iPad"),M=z("Android")&&!(C()||z("Firefox")||B()||z("Silk")),ia=C(),N=z("Safari")&&!(C()||z("Coast")||B()||z("Edge")||z("Silk")||z("Android"))&&!(A()||z("iPad")||z("iPod"));var ma={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},na={IMG:" ",BR:"\n"};function oa(a,c,b){if(!(a.nodeName in ma))if(3==a.nodeType)b?c.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):c.push(a.nodeValue);else if(a.nodeName in na)c.push(na[a.nodeName]);else for(a=a.firstChild;a;)oa(a,c,b),a=a.nextSibling};function O(a){return(a=a.exec(w))?a[1]:""}var pa=function(){if(fa)return O(/Firefox\/([0-9.]+)/);if(E||F||D)return I;if(ia)return O(/Chrome\/([0-9.]+)/);if(N&&!(A()||z("iPad")||z("iPod")))return O(/Version\/([0-9.]+)/);if(ga||ha){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(w);if(a)return a[1]+"."+a[2]}else if(M)return(a=O(/Android\s+([0-9.]+)/))?a:O(/Version\/([0-9.]+)/);return""}();var qa;function P(a){ra?qa(a):M?r(sa,a):r(pa,a)}var ra=function(){if(!G)return!1;var a=g.Components;if(!a)return!1;try{if(!a.classes)return!1}catch(f){return!1}var c=a.classes,a=a.interfaces,b=c["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator),d=c["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo).version;qa=function(a){b.compare(d,""+a)};return!0}(),Q;if(M){var ta=/Android\s+([0-9\.]+)/.exec(w);Q=ta?ta[1]:"0"}else Q="0";
8
- var sa=Q,ua=E&&!(8<=Number(L)),va=E&&!(9<=Number(L));M&&P(2.3);M&&P(4);N&&P(6);function R(a,c){c=c.toLowerCase();if("style"==c)return wa(a.style.cssText);if(ua&&"value"==c&&T(a,"INPUT"))return a.value;if(va&&!0===a[c])return String(a.getAttribute(c));var b=a.getAttributeNode(c);return b&&b.specified?b.value:null}var xa=/[;]+(?=(?:(?:[^"]*"){2})*[^"]*$)(?=(?:(?:[^']*'){2})*[^']*$)(?=(?:[^()]*\([^()]*\))*[^()]*$)/;
9
- function wa(a){var c=[];ca(a.split(xa),function(a){var d=a.indexOf(":");0<d&&(a=[a.slice(0,d),a.slice(d+1)],2==a.length&&c.push(a[0].toLowerCase(),":",a[1],";"))});c=c.join("");return c=";"==c.charAt(c.length-1)?c:c+";"}function U(a,c){var b;ua&&"value"==c&&T(a,"OPTION")&&null===R(a,"value")?(b=[],oa(a,b,!1),b=b.join("")):b=a[c];return b}function T(a,c){return!!a&&1==a.nodeType&&(!c||a.tagName.toUpperCase()==c)}
10
- function ya(a){return T(a,"OPTION")?!0:T(a,"INPUT")?(a=a.type.toLowerCase(),"checkbox"==a||"radio"==a):!1};var za={"class":"className",readonly:"readOnly"},V="async autofocus autoplay checked compact complete controls declare defaultchecked defaultselected defer disabled draggable ended formnovalidate hidden indeterminate iscontenteditable ismap itemscope loop multiple muted nohref noresize noshade novalidate nowrap open paused pubdate readonly required reversed scoped seamless seeking selected spellcheck truespeed willvalidate".split(" ");function Aa(a,c){var b=null,d=c.toLowerCase();if("style"==d)return(b=a.style)&&!l(b)&&(b=b.cssText),b;if(("selected"==d||"checked"==d)&&ya(a)){if(!ya(a))throw new m(15,"Element is not selectable");var b="selected",f=a.type&&a.type.toLowerCase();if("checkbox"==f||"radio"==f)b="checked";return U(a,b)?"true":null}var h=T(a,"A");if(T(a,"IMG")&&"src"==d||h&&"href"==d)return(b=R(a,d))&&(b=U(a,d)),b;if("spellcheck"==d){b=R(a,d);if(null!==b){if("false"==b.toLowerCase())return"false";if("true"==b.toLowerCase())return"true"}return U(a,
11
- d)+""}h=za[c]||c;a:if(l(V))d=l(d)&&1==d.length?V.indexOf(d,0):-1;else{for(var k=0;k<V.length;k++)if(k in V&&V[k]===d){d=k;break a}d=-1}if(0<=d)return(b=null!==R(a,c)||U(a,h))?"true":null;try{f=U(a,h)}catch(S){}(d=null==f)||(d=typeof f,d="object"==d&&null!=f||"function"==d);d?b=R(a,c):b=f;return null!=b?b.toString():null}var W=["_"],X=g;W[0]in X||!X.execScript||X.execScript("var "+W[0]);for(var Y;W.length&&(Y=W.shift());){var Z;if(Z=!W.length)Z=void 0!==Aa;Z?X[Y]=Aa: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.document:null}, arguments);}
1
+ function(){return function(){var d=this;function f(a){return"string"==typeof a};function h(a,b){this.code=a;this.a=l[a]||m;this.message=b||"";a=this.a.replace(/((?:^|\s+)[a-z])/g,function(a){return a.toUpperCase().replace(/^[\s\xa0]+/g,"")});b=a.length-5;if(0>b||a.indexOf("Error",b)!=b)a+="Error";this.name=a;a=Error(this.message);a.name=this.name;this.stack=a.stack||""}
2
+ (function(){var a=Error;function b(){}b.prototype=a.prototype;h.b=a.prototype;h.prototype=new b;h.prototype.constructor=h;h.a=function(b,c,g){for(var e=Array(arguments.length-2),k=2;k<arguments.length;k++)e[k-2]=arguments[k];return a.prototype[c].apply(b,e)}})();var m="unknown error",l={15:"element not selectable",11:"element not visible"};l[31]=m;l[30]=m;l[24]="invalid cookie domain";l[29]="invalid element coordinates";l[12]="invalid element state";l[32]="invalid selector";l[51]="invalid selector";
3
+ l[52]="invalid selector";l[17]="javascript error";l[405]="unsupported operation";l[34]="move target out of bounds";l[27]="no such alert";l[7]="no such element";l[8]="no such frame";l[23]="no such window";l[28]="script timeout";l[33]="session not created";l[10]="stale element reference";l[21]="timeout";l[25]="unable to set cookie";l[26]="unexpected alert open";l[13]=m;l[9]="unknown command";h.prototype.toString=function(){return this.name+": "+this.message};var n;a:{var p=d.navigator;if(p){var q=p.userAgent;if(q){n=q;break a}}n=""}function r(a){return-1!=n.indexOf(a)};function t(a,b){for(var e=a.length,c=f(a)?a.split(""):a,g=0;g<e;g++)g in c&&b.call(void 0,c[g],g,a)};function v(){return r("iPhone")&&!r("iPod")&&!r("iPad")};function w(){return(r("Chrome")||r("CriOS"))&&!r("Edge")};var x=r("Opera"),y=r("Trident")||r("MSIE"),z=r("Edge"),A=r("Gecko")&&!(-1!=n.toLowerCase().indexOf("webkit")&&!r("Edge"))&&!(r("Trident")||r("MSIE"))&&!r("Edge"),aa=-1!=n.toLowerCase().indexOf("webkit")&&!r("Edge");function B(){var a=d.document;return a?a.documentMode:void 0}var C;
4
+ a:{var D="",E=function(){var a=n;if(A)return/rv\:([^\);]+)(\)|;)/.exec(a);if(z)return/Edge\/([\d\.]+)/.exec(a);if(y)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(aa)return/WebKit\/(\S+)/.exec(a);if(x)return/(?:Version)[ \/]?(\S+)/.exec(a)}();E&&(D=E?E[1]:"");if(y){var F=B();if(null!=F&&F>parseFloat(D)){C=String(F);break a}}C=D}var G;var H=d.document;G=H&&y?B()||("CSS1Compat"==H.compatMode?parseInt(C,10):5):void 0;var ba=r("Firefox"),ca=v()||r("iPod"),da=r("iPad"),I=r("Android")&&!(w()||r("Firefox")||r("Opera")||r("Silk")),ea=w(),J=r("Safari")&&!(w()||r("Coast")||r("Opera")||r("Edge")||r("Silk")||r("Android"))&&!(v()||r("iPad")||r("iPod"));function K(a){return(a=a.exec(n))?a[1]:""}(function(){if(ba)return K(/Firefox\/([0-9.]+)/);if(y||z||x)return C;if(ea)return v()||r("iPad")||r("iPod")?K(/CriOS\/([0-9.]+)/):K(/Chrome\/([0-9.]+)/);if(J&&!(v()||r("iPad")||r("iPod")))return K(/Version\/([0-9.]+)/);if(ca||da){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(n);if(a)return a[1]+"."+a[2]}else if(I)return(a=K(/Android\s+([0-9.]+)/))?a:K(/Version\/([0-9.]+)/);return""})();var L,M=function(){if(!A)return!1;var a=d.Components;if(!a)return!1;try{if(!a.classes)return!1}catch(g){return!1}var b=a.classes,a=a.interfaces,e=b["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator),c=b["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo).version;L=function(a){e.compare(c,""+a)};return!0}(),N=y&&!(8<=Number(G)),fa=y&&!(9<=Number(G));I&&M&&L(2.3);I&&M&&L(4);J&&M&&L(6);var ga={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},O={IMG:" ",BR:"\n"};function P(a,b,e){if(!(a.nodeName in ga))if(3==a.nodeType)e?b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in O)b.push(O[a.nodeName]);else for(a=a.firstChild;a;)P(a,b,e),a=a.nextSibling};function Q(a,b){b=b.toLowerCase();return"style"==b?ha(a.style.cssText):N&&"value"==b&&R(a,"INPUT")?a.value:fa&&!0===a[b]?String(a.getAttribute(b)):(a=a.getAttributeNode(b))&&a.specified?a.value:null}var ia=/[;]+(?=(?:(?:[^"]*"){2})*[^"]*$)(?=(?:(?:[^']*'){2})*[^']*$)(?=(?:[^()]*\([^()]*\))*[^()]*$)/;
5
+ function ha(a){var b=[];t(a.split(ia),function(a){var c=a.indexOf(":");0<c&&(a=[a.slice(0,c),a.slice(c+1)],2==a.length&&b.push(a[0].toLowerCase(),":",a[1],";"))});b=b.join("");return b=";"==b.charAt(b.length-1)?b:b+";"}function S(a,b){N&&"value"==b&&R(a,"OPTION")&&null===Q(a,"value")?(b=[],P(a,b,!1),a=b.join("")):a=a[b];return a}function R(a,b){b&&"string"!==typeof b&&(b=b.toString());return!!a&&1==a.nodeType&&(!b||a.tagName.toUpperCase()==b)}
6
+ function T(a){return R(a,"OPTION")?!0:R(a,"INPUT")?(a=a.type.toLowerCase(),"checkbox"==a||"radio"==a):!1};var ja={"class":"className",readonly:"readOnly"},U="async autofocus autoplay checked compact complete controls declare defaultchecked defaultselected defer disabled draggable ended formnovalidate hidden indeterminate iscontenteditable ismap itemscope loop multiple muted nohref noresize noshade novalidate nowrap open paused pubdate readonly required reversed scoped seamless seeking selected spellcheck truespeed willvalidate".split(" ");function V(a,b){var e=null,c=b.toLowerCase();if("style"==c)return(e=a.style)&&!f(e)&&(e=e.cssText),e;if(("selected"==c||"checked"==c)&&T(a)){if(!T(a))throw new h(15,"Element is not selectable");b="selected";e=a.type&&a.type.toLowerCase();if("checkbox"==e||"radio"==e)b="checked";return S(a,b)?"true":null}var g=R(a,"A");if(R(a,"IMG")&&"src"==c||g&&"href"==c)return(e=Q(a,c))&&(e=S(a,c)),e;if("spellcheck"==c){e=Q(a,c);if(null!==e){if("false"==e.toLowerCase())return"false";if("true"==e.toLowerCase())return"true"}return S(a,
7
+ c)+""}g=ja[b]||b;a:if(f(U))c=f(c)&&1==c.length?U.indexOf(c,0):-1;else{for(var u=0;u<U.length;u++)if(u in U&&U[u]===c){c=u;break a}c=-1}if(0<=c)return(e=null!==Q(a,b)||S(a,g))?"true":null;try{var k=S(a,g)}catch(ka){}(c=null==k)||(c=typeof k,c="object"==c&&null!=k||"function"==c);c?e=Q(a,b):e=k;return null!=e?e.toString():null}var W=["_"],X=d;W[0]in X||!X.execScript||X.execScript("var "+W[0]);
8
+ for(var Y;W.length&&(Y=W.shift());){var Z;if(Z=!W.length)Z=void 0!==V;Z?X[Y]=V:X[Y]&&X[Y]!==Object.prototype[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.document:null}, arguments);}
@@ -81,7 +81,7 @@ module Selenium
81
81
  end
82
82
 
83
83
  #
84
- # Add a command-line argument to use when starting Chrome
84
+ # Add a command-line argument to use when starting Chrome.
85
85
  #
86
86
  # @example Start Chrome maximized
87
87
  # options = Selenium::WebDriver::Chrome::Options.new
@@ -164,7 +164,7 @@ module Selenium
164
164
  opts[:prefs] = @prefs unless @prefs.empty?
165
165
  opts
166
166
  end
167
- end # Profile
167
+ end # Options
168
168
  end # Chrome
169
169
  end # WebDriver
170
170
  end # Selenium
@@ -161,7 +161,8 @@ module Selenium
161
161
  def find_in_program_files(*binary_names)
162
162
  paths = [
163
163
  ENV['PROGRAMFILES'] || '\\Program Files',
164
- ENV['ProgramFiles(x86)'] || '\\Program Files (x86)'
164
+ ENV['ProgramFiles(x86)'] || '\\Program Files (x86)',
165
+ ENV['ProgramW6432'] || '\\Program Files'
165
166
  ]
166
167
 
167
168
  paths.each do |root|
@@ -79,7 +79,7 @@ module Selenium
79
79
  @process = ChildProcess.build(*args)
80
80
  WebDriver.logger.debug("Executing Process #{args}")
81
81
 
82
- @process.io.stdout = @process.io.stderr = WebDriver.logger.io
82
+ @process.io.stdout = @process.io.stderr = WebDriver.logger.io if WebDriver.logger.debug?
83
83
  @process.start
84
84
  end
85
85
 
@@ -133,7 +133,7 @@ module Selenium
133
133
 
134
134
  {KEY => opts}
135
135
  end
136
- end # Profile
136
+ end # Options
137
137
  end # Firefox
138
138
  end # WebDriver
139
139
  end # Selenium
@@ -18,6 +18,7 @@
18
18
  # under the License.
19
19
 
20
20
  require 'selenium/webdriver/ie/driver'
21
+ require 'selenium/webdriver/ie/options'
21
22
  require 'selenium/webdriver/ie/service'
22
23
 
23
24
  module Selenium
@@ -31,7 +31,7 @@ module Selenium
31
31
  include DriverExtensions::TakesScreenshot
32
32
 
33
33
  def initialize(opts = {})
34
- opts[:desired_capabilities] ||= Remote::Capabilities.internet_explorer
34
+ opts[:desired_capabilities] = create_capabilities(opts)
35
35
 
36
36
  unless opts.key?(:url)
37
37
  driver_path = opts.delete(:driver_path) || IE.driver_path
@@ -54,11 +54,6 @@ module Selenium
54
54
  opts[:url] = @service.uri
55
55
  end
56
56
 
57
- if opts.delete(:introduce_flakiness_by_ignoring_security_domains)
58
- opts[:desired_capabilities][:ignore_protected_mode_settings] = true
59
- end
60
- opts[:desired_capabilities][:native_events] = opts.delete(:native_events) != false
61
-
62
57
  listener = opts.delete(:listener)
63
58
  @bridge = Remote::Bridge.handshake(opts)
64
59
  super(@bridge, listener: listener)
@@ -74,6 +69,34 @@ module Selenium
74
69
  @service.stop if @service
75
70
  end
76
71
 
72
+ private
73
+
74
+ def create_capabilities(opts)
75
+ caps = opts.delete(:desired_capabilities) { Remote::Capabilities.internet_explorer }
76
+ options = opts.delete(:options) { Options.new }
77
+
78
+ if opts.delete(:introduce_flakiness_by_ignoring_security_domains)
79
+ WebDriver.logger.deprecate ':introduce_flakiness_by_ignoring_security_domains',
80
+ 'Selenium::WebDriver::IE::Options#ignore_protected_mode_settings='
81
+ options.ignore_protected_mode_settings = true
82
+ end
83
+
84
+ native_events = opts.delete(:native_events)
85
+ unless native_events.nil?
86
+ WebDriver.logger.deprecate ':native_events', 'Selenium::WebDriver::IE::Options#native_events='
87
+ options.native_events = native_events
88
+ end
89
+
90
+ # Backward compatibility with older IEDriverServer versions
91
+ caps[:ignore_protected_mode_settings] = options.ignore_protected_mode_settings
92
+ caps[:native_events] = options.native_events
93
+
94
+ options = options.as_json
95
+ caps.merge!(options) unless options.empty?
96
+
97
+ caps
98
+ end
99
+
77
100
  end # Driver
78
101
  end # IE
79
102
  end # WebDriver
@@ -0,0 +1,138 @@
1
+ # encoding: utf-8
2
+ #
3
+ # Licensed to the Software Freedom Conservancy (SFC) under one
4
+ # or more contributor license agreements. See the NOTICE file
5
+ # distributed with this work for additional information
6
+ # regarding copyright ownership. The SFC licenses this file
7
+ # to you under the Apache License, Version 2.0 (the
8
+ # "License"); you may not use this file except in compliance
9
+ # with the License. You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing,
14
+ # software distributed under the License is distributed on an
15
+ # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
+ # KIND, either express or implied. See the License for the
17
+ # specific language governing permissions and limitations
18
+ # under the License.
19
+
20
+ module Selenium
21
+ module WebDriver
22
+ module IE
23
+ class Options
24
+ KEY = 'se:ieOptions'.freeze
25
+ SCROLL_TOP = 0
26
+ SCROLL_BOTTOM = 1
27
+ CAPABILITIES = {
28
+ browser_attach_timeout: 'browserAttachTimeout',
29
+ element_scroll_behavior: 'elementScrollBehavior',
30
+ full_page_screenshot: 'ie.enableFullPageScreenshot',
31
+ ensure_clean_session: 'ie.ensureCleanSession',
32
+ file_upload_dialog_timeout: 'ie.fileUploadDialogTimeout',
33
+ force_create_process_api: 'ie.forceCreateProcessApi',
34
+ force_shell_windows_api: 'ie.forceShellWindowsApi',
35
+ ignore_protected_mode_settings: 'ignoreProtectedModeSettings',
36
+ ignore_zoom_level: 'ignoreZoomSetting',
37
+ initial_browser_url: 'initialBrowserUrl',
38
+ native_events: 'nativeEvents',
39
+ persistent_hover: 'enablePersistentHover',
40
+ require_window_focus: 'requireWindowFocus',
41
+ use_per_process_proxy: 'ie.usePerProcessProxy',
42
+ validate_cookie_document_type: 'ie.validateCookieDocumentType'
43
+ }.freeze
44
+
45
+ CAPABILITIES.keys.each do |key|
46
+ define_method key do
47
+ @options[key]
48
+ end
49
+
50
+ define_method "#{key}=" do |value|
51
+ @options[key] = value
52
+ end
53
+ end
54
+
55
+ attr_reader :args, :options
56
+
57
+ #
58
+ # Create a new Options instance
59
+ #
60
+ # @example
61
+ # options = Selenium::WebDriver::IE::Options.new(args: ['--host=127.0.0.1'])
62
+ # driver = Selenium::WebDriver.for(:ie, options: options)
63
+ #
64
+ # @example
65
+ # options = Selenium::WebDriver::IE::Options.new
66
+ # options.element_scroll_behavior = Selenium::WebDriver::IE::Options::SCROLL_BOTTOM
67
+ # driver = Selenium::WebDriver.for(:ie, options: options)
68
+ #
69
+ # @param [Hash] options the pre-defined options
70
+ # @option options [Array<String>] args
71
+ # @option options [Integer] browser_attach_timeout
72
+ # @option options [Integer] element_scroll_behavior Either SCROLL_TOP or SCROLL_BOTTOM
73
+ # @option options [Boolean] full_page_screenshot
74
+ # @option options [Boolean] ensure_clean_session
75
+ # @option options [Integer] file_upload_dialog_timeout
76
+ # @option options [Boolean] force_create_process_api
77
+ # @option options [Boolean] force_shell_windows_api
78
+ # @option options [Boolean] ignore_protected_mode_settings
79
+ # @option options [Boolean] ignore_zoom_level
80
+ # @option options [String] initial_browser_url
81
+ # @option options [Boolean] native_events
82
+ # @option options [Boolean] persistent_hover
83
+ # @option options [Boolean] require_window_focus
84
+ # @option options [Boolean] use_per_process_proxy
85
+ # @option options [Boolean] validate_cookie_document_type
86
+ #
87
+
88
+ def initialize(**opts)
89
+ @args = opts.delete(:args) || []
90
+ @options = opts
91
+ @options[:native_events] ||= true
92
+ end
93
+
94
+ #
95
+ # Add a command-line argument to use when starting Internet Explorer.
96
+ #
97
+ # @param [String] arg The command-line argument to add
98
+ #
99
+
100
+ def add_argument(arg)
101
+ @args << arg
102
+ end
103
+
104
+ #
105
+ # Add a new option not yet handled by these bindings.
106
+ #
107
+ # @example
108
+ # options = Selenium::WebDriver::IE::Options.new
109
+ # options.add_option(:foo, 'bar')
110
+ #
111
+ # @param [String, Symbol] name Name of the option
112
+ # @param [Boolean, String, Integer] value Value of the option
113
+ #
114
+
115
+ def add_option(name, value)
116
+ @options[name] = value
117
+ end
118
+
119
+ #
120
+ # @api private
121
+ #
122
+
123
+ def as_json(*)
124
+ opts = {}
125
+
126
+ CAPABILITIES.each do |capability_alias, capability_name|
127
+ capability_value = @options.delete(capability_alias)
128
+ opts[capability_name] = capability_value unless capability_value.nil?
129
+ end
130
+ opts['ie.browserCommandLineSwitches'] = @args.join(' ') if @args.any?
131
+ opts.merge!(@options)
132
+
133
+ {KEY => opts}
134
+ end
135
+ end # Options
136
+ end # IE
137
+ end # WebDriver
138
+ end # Selenium
@@ -167,7 +167,7 @@ module Selenium
167
167
  unless handle == :current
168
168
  raise Error::WebDriverError, 'Switch to desired window before changing its size'
169
169
  end
170
- execute :set_window_rect, {}, {width: width, height: height}
170
+ set_window_rect(width: width, height: height)
171
171
  end
172
172
 
173
173
  def window_size(handle = :current)
@@ -195,7 +195,7 @@ module Selenium
195
195
  end
196
196
 
197
197
  def reposition_window(x, y)
198
- execute :set_window_rect, {}, {x: x, y: y}
198
+ set_window_rect(x: x, y: y)
199
199
  end
200
200
 
201
201
  def window_position
@@ -204,7 +204,9 @@ module Selenium
204
204
  end
205
205
 
206
206
  def set_window_rect(x: nil, y: nil, width: nil, height: nil)
207
- execute :set_window_rect, {}, {x: x, y: y, width: width, height: height}
207
+ params = {x: x, y: y, width: width, height: height}
208
+ params.update(params) { |k, v| Integer(v) unless v.nil? }
209
+ execute :set_window_rect, {}, params
208
210
  end
209
211
 
210
212
  def window_rect
@@ -142,7 +142,7 @@ module Selenium
142
142
 
143
143
  #
144
144
  # Creates W3C compliant capabilities from OSS ones.
145
- # @param [Hash, Remote::Capabilities]
145
+ # @param oss_capabilities [Hash, Remote::Capabilities]
146
146
  #
147
147
 
148
148
  def from_oss(oss_capabilities)
@@ -156,11 +156,6 @@ module Selenium
156
156
 
157
157
  capability_name = name.to_s
158
158
 
159
- if capability_name == 'firefox_options'
160
- msg = ':firefox_options is no longer a valid parameter for Remote::Capabilities, use Firefox::Options instead'
161
- raise Error::WebDriverError msg
162
- end
163
-
164
159
  snake_cased_capability_names = KNOWN.map(&:to_s)
165
160
  camel_cased_capability_names = snake_cased_capability_names.map(&w3c_capabilities.method(:camel_case))
166
161
 
@@ -171,6 +166,27 @@ module Selenium
171
166
  w3c_capabilities[name] = value
172
167
  end
173
168
 
169
+ # User can pass :firefox_options or :firefox_profile.
170
+ #
171
+ # TODO (alex): Refactor this whole method into converter class.
172
+ firefox_options = oss_capabilities['firefoxOptions'] || oss_capabilities['firefox_options'] || oss_capabilities[:firefox_options]
173
+ firefox_profile = oss_capabilities['firefox_profile'] || oss_capabilities[:firefox_profile]
174
+ firefox_binary = oss_capabilities['firefox_binary'] || oss_capabilities[:firefox_binary]
175
+
176
+ if firefox_profile && firefox_options
177
+ second_profile = firefox_options['profile'] || firefox_options[:profile]
178
+ if second_profile && firefox_profile != second_profile
179
+ raise Error::WebDriverError, 'You cannot pass 2 different Firefox profiles'
180
+ end
181
+ end
182
+
183
+ if firefox_options || firefox_profile || firefox_binary
184
+ options = WebDriver::Firefox::Options.new(firefox_options || {})
185
+ options.binary = firefox_binary if firefox_binary
186
+ options.profile = firefox_profile if firefox_profile
187
+ w3c_capabilities.merge!(options.as_json)
188
+ end
189
+
174
190
  w3c_capabilities
175
191
  end
176
192
  end
@@ -181,7 +197,7 @@ module Selenium
181
197
  # @option :browser_version [String] required browser version number
182
198
  # @option :platform_name [Symbol] one of :any, :win, :mac, or :x
183
199
  # @option :platform_version [String] required platform version number
184
- # @option :accept_insecure_certs [Boolean] does the driver accept SSL Cerfifications?
200
+ # @option :accept_insecure_certs [Boolean] does the driver accept insecure SSL certifications?
185
201
  # @option :proxy [Selenium::WebDriver::Proxy, Hash] proxy configuration
186
202
  #
187
203
  # @api public
@@ -5,7 +5,7 @@ raise "cwd must be #{root} when reading gemspec" if root != Dir.pwd
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'selenium-webdriver'
8
- s.version = '3.4.4'
8
+ s.version = '3.5.0'
9
9
 
10
10
  s.authors = ['Alex Rodionov', 'Titus Fortner']
11
11
  s.email = ['p0deje@gmail.com', 'titusfortner@gmail.com']
@@ -28,5 +28,5 @@ HTML of the application.'
28
28
  s.add_development_dependency 'rspec', ['~> 3.0']
29
29
  s.add_development_dependency 'rack', ['~> 1.0']
30
30
  s.add_development_dependency 'webmock', ['~> 2.0']
31
- s.add_development_dependency 'yard', ['~> 0.8.7']
31
+ s.add_development_dependency 'yard', ['~> 0.9.9']
32
32
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-webdriver
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.4.4
5
+ version: 3.5.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alex Rodionov
@@ -11,7 +11,7 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2017-07-13 00:00:00 +07:00
14
+ date: 2017-08-10 00:00:00 -05:00
15
15
  default_executable:
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
@@ -77,7 +77,7 @@ dependencies:
77
77
  requirements:
78
78
  - - ~>
79
79
  - !ruby/object:Gem::Version
80
- version: 0.8.7
80
+ version: 0.9.9
81
81
  type: :development
82
82
  version_requirements: *id006
83
83
  description: |-
@@ -96,7 +96,6 @@ extra_rdoc_files: []
96
96
  files:
97
97
  - CHANGES
98
98
  - Gemfile
99
- - Gemfile.lock
100
99
  - LICENSE
101
100
  - README.md
102
101
  - selenium-webdriver.gemspec
@@ -192,6 +191,7 @@ files:
192
191
  - lib/selenium/webdriver/firefox/native/linux/amd64/x_ignore_nofocus.so
193
192
  - lib/selenium/webdriver/firefox/native/linux/x86/x_ignore_nofocus.so
194
193
  - lib/selenium/webdriver/ie/driver.rb
194
+ - lib/selenium/webdriver/ie/options.rb
195
195
  - lib/selenium/webdriver/ie/service.rb
196
196
  - lib/selenium/webdriver/phantomjs/driver.rb
197
197
  - lib/selenium/webdriver/phantomjs/service.rb
@@ -1,54 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- selenium-webdriver (3.4.3)
5
- childprocess (~> 0.5)
6
- rubyzip (~> 1.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- addressable (2.5.1)
12
- public_suffix (~> 2.0, >= 2.0.2)
13
- childprocess (0.7.0)
14
- ffi (~> 1.0, >= 1.0.11)
15
- crack (0.4.3)
16
- safe_yaml (~> 1.0.0)
17
- diff-lcs (1.3)
18
- ffi (1.9.18)
19
- hashdiff (0.3.4)
20
- public_suffix (2.0.5)
21
- rack (1.6.8)
22
- rspec (3.6.0)
23
- rspec-core (~> 3.6.0)
24
- rspec-expectations (~> 3.6.0)
25
- rspec-mocks (~> 3.6.0)
26
- rspec-core (3.6.0)
27
- rspec-support (~> 3.6.0)
28
- rspec-expectations (3.6.0)
29
- diff-lcs (>= 1.2.0, < 2.0)
30
- rspec-support (~> 3.6.0)
31
- rspec-mocks (3.6.0)
32
- diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.6.0)
34
- rspec-support (3.6.0)
35
- rubyzip (1.2.1)
36
- safe_yaml (1.0.4)
37
- webmock (2.3.2)
38
- addressable (>= 2.3.6)
39
- crack (>= 0.3.2)
40
- hashdiff
41
- yard (0.8.7.6)
42
-
43
- PLATFORMS
44
- ruby
45
-
46
- DEPENDENCIES
47
- rack (~> 1.0)
48
- rspec (~> 3.0)
49
- selenium-webdriver!
50
- webmock (~> 2.0)
51
- yard (~> 0.8.7)
52
-
53
- BUNDLED WITH
54
- 1.15.1