public OperaRunner getRunner ( ) { String klassName = ( String ) options . get ( RUNNER ) . getValue ( ) ; // If no runner is set, use the default one if ( klassName == null ) { setRunner ( OperaLauncherRunner . class ) ; return getRunner ( ) ; } Class < ? > klass ; try { klass = Class . forName ( klassName ) ; } catch ( ClassNotFoundException e ) { throw new WebDriverException ( "Unable to find runner class on classpath: " + klassName ) ; } Constructor constructor ; try { constructor = klass . getDeclaredConstructor ( OperaSettings . class ) ; } catch ( NoSuchMethodException e ) { throw new WebDriverException ( "Invalid constructor in runner: " + klass . getName ( ) ) ; } OperaRunner runner ; try { runner = ( OperaRunner ) constructor . newInstance ( this ) ; } catch ( InstantiationException e ) { throw new WebDriverException ( "Unable to create new instance of runner" , e ) ; } catch ( IllegalAccessException e ) { throw new WebDriverException ( "Denied access to runner: " + klass . getName ( ) ) ; } catch ( InvocationTargetException e ) { throw new WebDriverException ( "Runner threw exception on construction" , e ) ; } return runner ; }
Get the runner to use for starting and managing the Opera instance .