Check if a web driver if mobile.

        Args:
            webdriver (WebDriver): Selenium webdriver.
17538
def is_webdriver_mobile(webdriver):
        
        browser = webdriver.capabilities['browserName']

        if (browser == u('iPhone') or 
            browser == u('android')):
            return True
        else:
            return False
727102
def webdriver_assert(self, assertion, failure_message='Failed Assertion'):
        
        try:
            assert assertion() is True
        except AssertionError:
            raise WebDriverAssertionException.WebDriverAssertionException(self.driver_wrapper, failure_message)

        return True
451164
public boolean detectFirefoxOSPhone() {

        //First, let's make sure we're NOT on another major mobile OS.
        if (detectIos() || detectAndroid() || detectSailfish()) {
            return false;
        }

        if ((userAgent.indexOf(engineFirefox) != -1) && (userAgent.indexOf(mobile) != -1)) {
            return true;
        }

        return false;
    }
1330534
def is_element_available(self, locator):
        
        if self.driver.is_element_present(locator):
            if self.driver.is_visible(locator):
                return True
            else:
                return False
        else:
            return False
34214
String scanForDriver(String url) {
    try {
      // already registered
      Driver driver;
      if ((driver = findRegisteredDriver(url)) != null) {
        return driver.getClass().getCanonicalName();
      }

      scanDrivers();

      if ((driver = findRegisteredDriver(url)) != null) {
        return driver.getClass().getCanonicalName();
      }

      return null;
    } catch (Exception e) {
      e.printStackTrace();
      debug(e.toString());
      return null;
    }
  }
140477
def grab_selenium_driver(driver_name=None):
    
    from selenium import webdriver
    if driver_name is None:
        driver_name = 'firefox'
    if driver_name.lower() == 'chrome':
        grab_selenium_chromedriver()
        return webdriver.Chrome()
    elif driver_name.lower() == 'firefox':
        # grab_selenium_chromedriver()
        return webdriver.Firefox()
    else:
        raise AssertionError('unknown name = %r' % (driver_name,))
710296
def detectFirefoxOSTablet(self):
        
        if self.detectIos() \
            or self.detectAndroid() \
            or self.detectSailfish():
            return False

        if UAgentInfo.engineFirefox in self.__userAgent \
           and UAgentInfo.deviceTablet in self.__userAgent:
            return True

        return False
1048308
def hover(self):
        
        def do_hover():
            """
            Perform hover
            """
            ActionChains(self.driver_wrapper.driver).move_to_element(self.element).perform()
        return self.execute_and_handle_webelement_exceptions(do_hover, 'hover')
1091803
def destroy_webdriver(driver):
    

    # This is some very flaky code in selenium. Hence the retries
    # and catch-all exceptions
    try:
        retry_call(driver.close, tries=2)
    except Exception:
        pass
    try:
        driver.quit()
    except Exception:
        pass
1342345
def selenium(self):
        
        if not self._web_driver:
            self._web_driver = self._start_driver()
        return self._web_driver
20423
def get_driver_status(driver):  # noqa: E501
    

    response = errorIfUnauthorized(role='admin')
    if response:
        return response
    else:
        response = ApitaxResponse()

    driver: Driver = LoadedDrivers.getDriver(driver)
    response.body.add({'name': driver.getDriverName()})
    response.body.add({'description': driver.getDriverDescription()})
    response.body.add({'tips': driver.getDriverTips()})
    response.body.add({'help': driver.getDriverHelpEndpoint()})
    response.body.add({'minimum-role': driver.getDriverMinimumRole()})

    options = {}
    options['configurable'] = driver.isDriverConfigurable()
    options['authenticatable'] = driver.isDriverAuthenticatable()
    options['role-restricted'] = driver.isDriverRoleRestricted()
    options['whitelisted'] = driver.isDriverWhitelisted()
    options['blacklisted'] = driver.isDriverBlacklisted()
    response.body.add({'options': options})

    return Response(status=200, body=response.getResponseBody())
1148642
public boolean getElementExists(By locator) {
		waitForLoaders();
		List<WebElement> foundElements = getWebDriver().findElements(locator);
		return (foundElements.size() > 0);
	}
709331
public static void assertAccessibility(WebDriver webDriver, Testable testable) {
        assertThat(webDriver, is(compliantTo(testable)));
    }
889063
def is_for_driver_task(self):
        
        return all(
            len(x) == 0
            for x in [self.module_name, self.class_name, self.function_name])
210868
function SeleniumWebdriverBrowser(id, baseBrowserDecorator, args, logger) {
  baseBrowserDecorator(this);

  var self = this;
  var captured = false;
  var log = logger.create('launcher.selenium-webdriver');
  var browserName = args.browserName;
  var killingPromise;

  self.id = id;
  self.setName(browserName);

  log.info('SeleniumWebdriverBrowser (kid:'+id+') created');

  self._start = function(url){
    log.info('starting '+self.name);
    var driver = args.getDriver();
    self.driver_ = driver;

    self.getSession_(function(session){
      // TODO: caps_ might be a defer as well
      self.setName(session.caps_.caps_);
    });

    log.info('sending driver to url '+url);
    driver.get(url);
  };

  self.kill = function(){

    // Already killed, or being killed.
    if (killingPromise) {
      return killingPromise;
    }

    var deferred = q.defer();

    killingPromise = deferred.promise;

    self.getSession_(function(session){
      log.info('requested to kill, session id is '+(session && session.id_));

      if (!session) {
        return deferred.reject();
      }

      if(session.id_){
        self.driver_ && self.driver_.quit();
        deferred.resolve();
      }
    });

    return killingPromise;

  };

  self.forceKill = function() {
    self.kill();
    return killingPromise;
  };

}
68723
public static <T> T augment(WebDriver driver) {
    Augmenter augmenter = new Augmenter();
    augmenter.addDriverAugmentation(IOSCapabilities.CONFIGURABLE, new AddConfigurable());
    augmenter.addDriverAugmentation(IOSCapabilities.ELEMENT_TREE, new AddLogElementTree());
    augmenter.addDriverAugmentation(IOSCapabilities.IOS_SEARCH_CONTEXT, new AddIOSSearchContext());
    augmenter.addDriverAugmentation(IOSCapabilities.IOS_TOUCH_SCREEN, new AddIOSTouchScreen());
    return (T) augmenter.augment(driver);
  }
85987
function MobileDetection() {

  var IS_MOBILE;

  // Set our belief about whether the devise is mobile by inspecting ontouchstart
  this.detect = function() { IS_MOBILE = !!("ontouchstart" in window); };

  // Return the current belief about whether the browser is mobile.
  this.is = function() { return IS_MOBILE; };

  // This will generally only be done in tests.
  this.fake = function(value) { IS_MOBILE = value; };

  // Set the initial value of IS_MOBILE so that calls to isMobile will have
  // the correct value.
  this.detect();

}