Пример #1
0
 def linux_chrome_args(self):
     """
     linux os chrome browser parameter
     :return:
     """
     option = webdriver.ChromeOptions()
     option.add_argument('--no-sandbox')  # 取消沙盒模式
     option.add_argument('--disable-dev-shm-usage')
     option.add_argument('--headless')  # 浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败
     option.add_argument('--disable-gpu')  # 谷歌文档提到需要加上这个属性来规避bug
     option.add_argument('window-size=1920x1080')  # 指定浏览器分辨率
     return option
Пример #2
0
    def setUp(self):
        self.vars = {}

        timeout = 3.5
        options = webdriver.ChromeOptions()
        options.add_argument('--no-sandbox')
        options.add_argument('--disable-dev-shm-usage')
        options.add_argument('--disable-gpu')
        options.set_capability('unhandledPromptBehavior', 'ignore')
        options.set_capability('browserName', 'chrome')
        options.set_capability('deviceName', '')
        options.set_capability('platformName', 'android')
        self.driver = webdriver.Remote(
            command_executor='http://localhost:4723/wd/hub', options=options)
        self.driver.implicitly_wait(timeout)
        apiritif.put_into_thread_store(timeout=timeout,
                                       func_mode=False,
                                       driver=self.driver,
                                       windows={},
                                       scenario_name='loc_sc_appium')
Пример #3
0
def get_driver():
    chrome_option = webdriver.ChromeOptions()
    chrome_option.add_experimental_option("androidProcess",
                                          "com.tencent.mm:tools")
    desired_caps = {
        'platformName': 'Android',
        'platformVersion': '7.1.1',
        'deviceName': 'CB512BPKD9',
        #微信
        'appPackage': 'com.tencent.mm',
        'appActivity': 'ui.LauncherUI',
        'ChromeOptions.CAPABILITY': 'chrome_option',
        #技师APP
        #'appPackage': 'com.xmd.technician',
        #'appActivity': '.window.WelcomeActivity',
        #'appWaitActivity': '.window.MainActivity'
    }

    driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
    driver.implicitly_wait(30)
    return driver