File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed 
py/test/selenium/webdriver Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 1818import  os 
1919import  subprocess 
2020import  time 
21+ 
2122from  unittest .mock  import  patch 
2223
2324import  pytest 
Original file line number Diff line number Diff line change 1818import  os 
1919import  subprocess 
2020import  time 
21+ 
2122from  unittest .mock  import  patch 
2223
2324import  pytest 
Original file line number Diff line number Diff line change 1414# KIND, either express or implied.  See the License for the 
1515# specific language governing permissions and limitations 
1616# under the License. 
17+ 
1718import  os 
1819import  subprocess 
20+ 
1921from  unittest .mock  import  patch 
2022
2123import  pytest 
2224
2325from  selenium .webdriver  import  Firefox 
26+ from  selenium .common .exceptions  import  SessionNotCreatedException 
27+ from  selenium .common .exceptions  import  WebDriverException 
28+ from  selenium .webdriver .firefox .options  import  Options 
2429from  selenium .webdriver .firefox .service  import  Service 
2530
2631
@@ -61,6 +66,21 @@ def test_log_output_as_stdout(capfd) -> None:
6166    driver .quit ()
6267
6368
69+ def  test_driver_is_stopped_if_browser_cant_start (clean_driver , driver_executable ) ->  None :
70+     options  =  Options ()
71+     #options.set_preference('profile', "/no/such/location") 
72+     options .add_argument ("-profile==/no/such/location" )
73+     service  =  Service ()
74+     with  pytest .raises (SessionNotCreatedException ):
75+         driver  =  clean_driver (options = options , service = service )
76+     assert  not  service .is_connectable ()
77+     assert  service .process .poll () <  0 
78+     try :
79+         driver .quit ()
80+     except  Exception :
81+         pass 
82+ 
83+ 
6484@pytest .fixture  
6585def  service ():
6686    return  Service ()
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments