@@ -138,7 +138,7 @@ def start_session(self, desired_capabilities, browser_profile=None):
138
138
self .session_id = response ['sessionId' ]
139
139
self .capabilities = response ['value' ]
140
140
141
- self .capabilities ["marionette " ] = desired_capabilities .get ("marionette" , False )
141
+ self .capabilities ["w3c " ] = desired_capabilities .get ("marionette" , False )
142
142
143
143
def _wrap_value (self , value ):
144
144
if isinstance (value , dict ):
@@ -157,7 +157,7 @@ def create_web_element(self, element_id):
157
157
"""
158
158
Creates a web element with the specified element_id.
159
159
"""
160
- return WebElement (self , element_id )
160
+ return WebElement (self , element_id , w3c = self . capabilities [ 'w3c' ] )
161
161
162
162
def _unwrap_value (self , value ):
163
163
if isinstance (value , dict ) and ('ELEMENT' in value or 'element-6066-11e4-a52e-4f735466cecf' in value ):
@@ -503,7 +503,7 @@ def maximize_window(self):
503
503
Maximizes the current window that webdriver is using
504
504
"""
505
505
command = Command .MAXIMIZE_WINDOW
506
- if self .capabilities ['marionette ' ] == True :
506
+ if self .capabilities ['w3c ' ] == True :
507
507
command = Command .W3C_MAXIMIZE_WINDOW
508
508
self .execute (command , {"windowHandle" : "current" })
509
509
@@ -641,7 +641,7 @@ def implicitly_wait(self, time_to_wait):
641
641
:Usage:
642
642
driver.implicitly_wait(30)
643
643
"""
644
- if self .capabilities ["marionette " ] == True :
644
+ if self .capabilities ["w3c " ] == True :
645
645
self .execute (Command .SET_TIMEOUTS ,
646
646
{'ms' : float (time_to_wait ) * 1000 , 'type' :'implicit' })
647
647
else :
@@ -658,7 +658,7 @@ def set_script_timeout(self, time_to_wait):
658
658
:Usage:
659
659
driver.set_script_timeout(30)
660
660
"""
661
- if self .capabilities ["marionette " ] == True :
661
+ if self .capabilities ["w3c " ] == True :
662
662
self .execute (Command .SET_TIMEOUTS ,
663
663
{'ms' : float (time_to_wait ) * 1000 , 'type' :'script' })
664
664
else :
@@ -690,17 +690,18 @@ def find_element(self, by=By.ID, value=None):
690
690
"""
691
691
if not By .is_valid (by ) or not isinstance (value , str ):
692
692
raise InvalidSelectorException ("Invalid locator values passed in" )
693
- if by == By .ID :
694
- by = By .CSS_SELECTOR
695
- value = '[id="%s"]' % value
696
- elif by == By .TAG_NAME :
697
- by = By .CSS_SELECTOR
698
- elif by == By .CLASS_NAME :
699
- by = By .CSS_SELECTOR
700
- value = ".%s" % value
701
- elif by == By .NAME :
702
- by = By .CSS_SELECTOR
703
- value = '[name="%s"]' % value
693
+ if self .capabilities ['w3c' ] == True :
694
+ if by == By .ID :
695
+ by = By .CSS_SELECTOR
696
+ value = '[id="%s"]' % value
697
+ elif by == By .TAG_NAME :
698
+ by = By .CSS_SELECTOR
699
+ elif by == By .CLASS_NAME :
700
+ by = By .CSS_SELECTOR
701
+ value = ".%s" % value
702
+ elif by == By .NAME :
703
+ by = By .CSS_SELECTOR
704
+ value = '[name="%s"]' % value
704
705
return self .execute (Command .FIND_ELEMENT ,
705
706
{'using' : by , 'value' : value })['value' ]
706
707
@@ -715,18 +716,18 @@ def find_elements(self, by=By.ID, value=None):
715
716
"""
716
717
if not By .is_valid (by ) or not isinstance (value , str ):
717
718
raise InvalidSelectorException ("Invalid locator values passed in" )
718
-
719
- if by == By .ID :
720
- by = By .CSS_SELECTOR
721
- value = '[id="%s"]' % value
722
- elif by == By .TAG_NAME :
723
- by = By .CSS_SELECTOR
724
- elif by == By .CLASS_NAME :
725
- by = By .CSS_SELECTOR
726
- value = ".%s" % value
727
- elif by == By .NAME :
728
- by = By .CSS_SELECTOR
729
- value = '[name="%s"]' % value
719
+ if self . capabilities [ 'w3c' ] == True :
720
+ if by == By .ID :
721
+ by = By .CSS_SELECTOR
722
+ value = '[id="%s"]' % value
723
+ elif by == By .TAG_NAME :
724
+ by = By .CSS_SELECTOR
725
+ elif by == By .CLASS_NAME :
726
+ by = By .CSS_SELECTOR
727
+ value = ".%s" % value
728
+ elif by == By .NAME :
729
+ by = By .CSS_SELECTOR
730
+ value = '[name="%s"]' % value
730
731
731
732
return self .execute (Command .FIND_ELEMENTS ,
732
733
{'using' : by , 'value' : value })['value' ]
@@ -791,7 +792,7 @@ def set_window_size(self, width, height, windowHandle='current'):
791
792
driver.set_window_size(800,600)
792
793
"""
793
794
command = Command .SET_WINDOW_SIZE
794
- if self .capabilities ["marionette " ] == True :
795
+ if self .capabilities ["w3c " ] == True :
795
796
command = Command .W3C_SET_WINDOW_SIZE
796
797
self .execute (command , {'width' : int (width ), 'height' : int (height ),
797
798
'windowHandle' : windowHandle })
@@ -804,7 +805,7 @@ def get_window_size(self, windowHandle='current'):
804
805
driver.get_window_size()
805
806
"""
806
807
command = Command .GET_WINDOW_SIZE
807
- if self .capabilities ['marionette ' ] == True :
808
+ if self .capabilities ['w3c ' ] == True :
808
809
command = Command .W3C_GET_WINDOW_SIZE
809
810
size = self .execute (command ,
810
811
{'windowHandle' : windowHandle })
0 commit comments