Ejemplo n.º 1
0
def ie(path='./IEDriverServer.exe') -> WebDriver:
    """
    IE
    :param path:IE Driver路径
    :return: WebDriver
    """
    dr = IE(executable_path=path)
    dr.set_page_load_timeout(30)
    dr.implicitly_wait(10)
    dr.maximize_window()
    return dr
Ejemplo n.º 2
0
    def getWebDriver(self, browser):
        print(browser)

        if browser.upper() == "IE":
            driver = InternetExplorerDriver()
            driver.maximize_window()
            self.logger.appendContent("新建IE驱动")
            return driver
        elif browser.upper() == "CHROME":
            options = ChromeOptions()
            options.add_argument("test-type")
            driver = ChromeDriver(chrome_options=options)
            driver.maximize_window()
            self.logger.appendContent("新建chrome驱动")
            return driver
        elif browser.upper() == "FIREFOX":
            driver = FirefoxDriverDriver()
            driver.maximize_window()
            self.logger.appendContent("新建FireFox驱动")
            return driver
        else:
            return None