<s> try : <EOL> import http . client as http_client <EOL> except ImportError : <EOL> import httplib as http_client <EOL> import os <EOL> from selenium . webdriver . common . desired_capabilities import DesiredCapabilities <EOL> from selenium . webdriver . remote . webdriver import WebDriver as RemoteWebDriver <EOL> from selenium . webdriver . chrome . webdriver import WebDriver as ChromiumDriver <EOL> from . service import Service <EOL> from . options import Options <EOL> class OperaDriver ( ChromiumDriver ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , executable_path = None , port = <NUM_LIT:0> , <EOL> opera_options = None , service_args = None , <EOL> desired_capabilities = None , service_log_path = None ) : <EOL> """<STR_LIT>""" <EOL> executable_path = ( executable_path if executable_path is not None <EOL> else "<STR_LIT>" ) <EOL> ChromiumDriver . __init__ ( self , <EOL> executable_path = executable_path , <EOL> port = port , <EOL> chrome_options = opera_options , <EOL> service_args = service_args , <EOL> desired_capabilities = desired_capabilities , <EOL> service_log_path = service_log_path ) <EOL> def create_options ( self ) : <EOL> return Options ( ) <EOL> class PrestoDriver ( RemoteWebDriver ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , executable_path = None , port = <NUM_LIT:0> , <EOL> desired_capabilities = DesiredCapabilities . OPERA ) : <EOL> """<STR_LIT>""" <EOL> if executable_path is None : <EOL> try : <EOL> executable_path = os . environ [ "<STR_LIT>" ] <EOL> except : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> self . service = Service ( executable_path , port = port ) <EOL> self . service . start ( ) <EOL> RemoteWebDriver . __init__ ( self , <EOL> command_executor = self . service . service_url , <EOL> desired_capabilities = desired_capabilities ) <EOL> self . _is_remote = False <EOL> def quit ( self ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> RemoteWebDriver . quit ( self ) <EOL> except http_client . BadStatusLine : <EOL> pass <EOL> finally : <EOL> self . service . stop ( ) <EOL> class WebDriver ( PrestoDriver , OperaDriver ) : <EOL> class ServiceType : <EOL> PRESTO = <NUM_LIT:1> <EOL> CHROMIUM = <NUM_LIT:2> <EOL> def __init__ ( self , <EOL> desired_capabilities = None , <EOL> executable_path = None , <EOL> port = <NUM_LIT:0> , <EOL> service_log_path = None , <EOL> service_args = None , <EOL> opera_options = None ) : <EOL> engine = ( desired_capabilities . get ( '<STR_LIT>' , None ) <EOL> if desired_capabilities else None ) <EOL> if ( engine == WebDriver . ServiceType . CHROMIUM or <EOL> opera_options and opera_options . android_package_name ) : <EOL> OperaDriver . __init__ ( self , executable_path = executable_path , <EOL> port = port , opera_options = opera_options , <EOL> service_args = service_args , <EOL> desired_capabilities = desired_capabilities , <EOL> service_log_path = service_log_path ) <EOL> else : <EOL> if service_log_path : <EOL> print ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> if service_args : <EOL> print ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> if opera_options : <EOL> print ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> if not desired_capabilities : <EOL> desired_capabilities = DesiredCapabilities . OPERA <EOL> PrestoDriver . __init__ ( self , executable_path = executable_path , <EOL> port = port , <EOL> desired_capabilities = desired_capabilities ) </s>
