File tree Expand file tree Collapse file tree 3 files changed +38
-0
lines changed 
lib/selenium/webdriver/common 
integration/selenium/webdriver/chrome 
unit/selenium/webdriver/chrome Expand file tree Collapse file tree 3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,14 @@ def add_option(name, value = nil)
9191        @options [ name ]  =  value 
9292      end 
9393
94+       def  enable_bidi! 
95+         @options [ :web_socket_url ]  =  true 
96+       end 
97+ 
98+       def  bidi? 
99+         !!@options [ :web_socket_url ] 
100+       end 
101+ 
94102      def  ==( other ) 
95103        return  false  unless  other . is_a?  self . class 
96104
Original file line number Diff line number Diff line change @@ -43,6 +43,24 @@ module Chrome
4343            expect ( ua ) . to  eq ( 'foo;bar' ) 
4444          end 
4545        end 
46+ 
47+         it  'enables bidi'  do 
48+           quit_driver 
49+ 
50+           options  =  Selenium ::WebDriver ::Options . chrome 
51+           expect ( options . web_socket_url ) . to  be_nil 
52+           expect ( options . bidi? ) . to  be  false 
53+ 
54+           options . enable_bidi! 
55+           expect ( options . web_socket_url ) . to  be  true 
56+           expect ( options . bidi? ) . to  be  true 
57+ 
58+           driver  =  Selenium ::WebDriver . for  :chrome ,  options : options 
59+ 
60+           expect ( driver . capabilities . web_socket_url ) . to  be_a  String 
61+ 
62+           driver . quit 
63+         end 
4664      end 
4765    end  # Chrome 
4866  end  # WebDriver 
Original file line number Diff line number Diff line change @@ -141,6 +141,18 @@ module Chrome
141141          end 
142142        end 
143143
144+         describe  '#enable_bidi!'  do 
145+           it  'allows setting and querying bidi'  do 
146+             expect ( options . web_socket_url ) . to  be_nil 
147+             expect ( options . bidi? ) . to  be  false 
148+ 
149+             options . enable_bidi! 
150+ 
151+             expect ( options . bidi? ) . to  be  true 
152+             expect ( options . web_socket_url ) . to  be  true 
153+           end 
154+         end 
155+ 
144156        describe  '#add_extension'  do 
145157          it  'adds an extension'  do 
146158            allow ( File ) . to  receive ( :file? ) . and_return ( true ) 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments