Python appium.webdriver.Remote() Examples
The following are 30
code examples of appium.webdriver.Remote().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
appium.webdriver
, or try the search function
.
Example #1
Source File: DriverFactory.py From qxf2-page-object-model with MIT License | 10 votes |
def run_sauce_lab(self,os_name,os_version,browser,browser_version): "Run the test in sauce labs when remote flag is 'Y'" #Get the sauce labs credentials from sauce.credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['version'] = browser_version desired_capabilities['platform'] = os_name + ' '+os_version return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities)
Example #2
Source File: DriverFactory.py From qxf2-page-object-model with MIT License | 8 votes |
def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Run the test in browser stack when remote flag is 'Y'" #Get the browser stack credentials from browser stack credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['os'] = os_name desired_capabilities['os_version'] = os_version desired_capabilities['browser_version'] = browser_version if remote_project_name is not None: desired_capabilities['project'] = remote_project_name if remote_build_name is not None: desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c")) return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False), desired_capabilities=desired_capabilities)
Example #3
Source File: DriverFactory.py From makemework with MIT License | 8 votes |
def run_browserstack(self,os_name,os_version,browser,browser_version,remote_project_name,remote_build_name): "Run the test in browser stack when remote flag is 'Y'" #Get the browser stack credentials from browser stack credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['os'] = os_name desired_capabilities['os_version'] = os_version desired_capabilities['browser_version'] = browser_version if remote_project_name is not None: desired_capabilities['project'] = remote_project_name if remote_build_name is not None: desired_capabilities['build'] = remote_build_name+"_"+str(datetime.now().strftime("%c")) return webdriver.Remote(RemoteConnection("http://%s:%s@hub-cloud.browserstack.com/wd/hub"%(USERNAME,PASSWORD),resolve_ip= False), desired_capabilities=desired_capabilities)
Example #4
Source File: DriverFactory.py From makemework with MIT License | 8 votes |
def run_sauce_lab(self,os_name,os_version,browser,browser_version): "Run the test in sauce labs when remote flag is 'Y'" #Get the sauce labs credentials from sauce.credentials file USERNAME = remote_credentials.USERNAME PASSWORD = remote_credentials.ACCESS_KEY if browser.lower() == 'ff' or browser.lower() == 'firefox': desired_capabilities = DesiredCapabilities.FIREFOX elif browser.lower() == 'ie': desired_capabilities = DesiredCapabilities.INTERNETEXPLORER elif browser.lower() == 'chrome': desired_capabilities = DesiredCapabilities.CHROME elif browser.lower() == 'opera': desired_capabilities = DesiredCapabilities.OPERA elif browser.lower() == 'safari': desired_capabilities = DesiredCapabilities.SAFARI desired_capabilities['version'] = browser_version desired_capabilities['platform'] = os_name + ' '+os_version return webdriver.Remote(command_executor="http://%s:%s@ondemand.saucelabs.com:80/wd/hub"%(USERNAME,PASSWORD), desired_capabilities= desired_capabilities)
Example #5
Source File: webdriver_tests.py From python-client with Apache License 2.0 | 6 votes |
def test_all_sessions(self) -> None: port = get_available_from_port_range(8200, 8300) desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip') desired_caps['deviceName'] = 'iPhone Xs Max' desired_caps['wdaLocalPort'] = port class session_counts_is_two: TIMEOUT = 10 def __call__(self, driver: 'WebDriver') -> bool: return len(driver.all_sessions) == 2 driver2 = None try: driver2 = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) WebDriverWait( driver2, session_counts_is_two.TIMEOUT).until(session_counts_is_two()) assert len(self.driver.all_sessions) == 2 finally: if driver2 is not None: driver2.quit()
Example #6
Source File: wechat_moment.py From learn_python3_spider with MIT License | 6 votes |
def __init__(self): desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '5.1' desired_caps['deviceName'] = '88CKBM622PAM' desired_caps['appPackage'] = 'com.tencent.mm' desired_caps['appActivity'] = '.ui.LauncherUI' # 定义在朋友圈的时候滑动位置 self.start_x = 300 self.start_y = 800 self.end_x = 300 self.end_y = 300 # 启动微信 self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) # 设置等待 self.wait = WebDriverWait(self.driver, 300) print('微信启动...')
Example #7
Source File: ios.py From airtest with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, addr=None): if not addr: addr = '127.0.0.1' self.url = 'http://%s:4723/wd/hub' % addr self.driver = webdriver.Remote( command_executor=self.url, desired_capabilities={ 'platformName': 'iOS', # after appium 1.2.0, deviceName is required 'deviceName': 'ios device', 'autoLaunch': False } ) self._scale = None self.start() self._init()
Example #8
Source File: _applicationmanagement.py From robotframework-appiumlibrary with Apache License 2.0 | 6 votes |
def open_application(self, remote_url, alias=None, **kwargs): """Opens a new application to given Appium server. Capabilities of appium server, Android and iOS, Please check https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/server-args.md | *Option* | *Man.* | *Description* | | remote_url | Yes | Appium server url | | alias | no | alias | Examples: | Open Application | http://localhost:4723/wd/hub | alias=Myapp1 | platformName=iOS | platformVersion=7.0 | deviceName='iPhone Simulator' | app=your.app | | Open Application | http://localhost:4723/wd/hub | platformName=Android | platformVersion=4.2.2 | deviceName=192.168.56.101:5555 | app=${CURDIR}/demoapp/OrangeDemoApp.apk | appPackage=com.netease.qa.orangedemo | appActivity=MainActivity | """ desired_caps = kwargs application = webdriver.Remote(str(remote_url), desired_caps) self._debug('Opened application with session id %s' % application.session_id) return self._cache.register(application, alias)
Example #9
Source File: xhs_wechat.py From xhs_simple_crawler with MIT License | 6 votes |
def __init__(self): """ 初始化 """ # 驱动配置 self.desired_caps = { 'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': WECHAT_PACKAGE, 'appActivity': WECHAT_ACTIVITY, 'noReset': True, "automationName": "Uiautomator2" } self.driver = webdriver.Remote(DRIVER_SERVER, self.desired_caps) self.wait = WebDriverWait(self.driver, TIMEOUT) self.client = MongoClient(MONGO_URL) self.db = self.client[WECHAT_XHS_MONGO_DB] self.collection = self.db[WECHAT_XHS_MONGO_COLLECTION] # 处理器 self.processor = Processor()
Example #10
Source File: xhs_app.py From xhs_simple_crawler with MIT License | 6 votes |
def __init__(self): """ 初始化 """ # 驱动配置 self.desired_caps = { 'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': XHS_PACKAGE, 'appActivity': XHS_ACTIVITY, 'noReset': True, "automationName": "Uiautomator2" } global collection self.driver = webdriver.Remote(DRIVER_SERVER, self.desired_caps) self.wait = WebDriverWait(self.driver, TIMEOUT) self.client = MongoClient(MONGO_URL) self.db = self.client[XHS_MONGO_DB] self.collection = self.db[XHS_MONGO_COLLECTION] self.processor = Processor()
Example #11
Source File: integration.py From Auto_Analysis with MIT License | 6 votes |
def start_appium(self): """ 启动driver :return: """ number_of_starts = 0 while number_of_starts < 6: try: self.driver = webdriver.Remote( 'http://127.0.0.1:%s/wd/hub' % self.__get_appium_port(), self.device_l) U.Logging.debug('appium start %s success' % self.device) return self.driver except Exception as e: number_of_starts += 1 U.Logging.error('Failed to start appium :{}'.format(e)) U.Logging.error( 'Try restarting the appium :{},Trying the {} frequency'.format(self.device, number_of_starts)) U.sleep(5) if number_of_starts > 5: U.Logging.error('Can not start appium, the program exits') exit()
Example #12
Source File: InitAppiumDriver.py From AppiumTestProject with Apache License 2.0 | 6 votes |
def get_android_driver(self, sno): desired_caps = self.get_desired_capabilities(sno) self.before_create_driver(desired_caps['udid']) port = self.get_appium_port(desired_caps["udid"]) if not self.is_port_used(port): self.log4py.debug("设备号[{}]对应的appium服务没有启动".format(desired_caps['udid'])) return None url = 'http://127.0.0.1:%s/wd/hub' % (port.strip()) self.log4py.debug(url) self.log4py.debug(desired_caps) num = 0 while num <= 5: try: driver = webdriver.Remote(url, desired_caps) except urllib2.URLError as e: self.log4py.error("连接appium服务,实例化driver时出错,尝试重连...({})".format(num)) num = num + 1 continue if self.run_data["wait_activity"] is not None: driver.wait_activity(self.run_data["wait_activity"], 10) else: driver.implicitly_wait(10) self.log4py.info("webdriver连接信息:{}:{}".format(url, str(desired_caps))) return driver return None
Example #13
Source File: __init__.py From AutoXue with MIT License | 6 votes |
def __init__(self): self.connect() self.desired_caps = { "platformName": caps["platformname"], "platformVersion": caps["platformversion"], "automationName": caps["automationname"], "unicodeKeyboard": caps["unicodekeyboard"], "resetKeyboard": caps["resetkeyboard"], "noReset": caps["noreset"], 'newCommandTimeout': 800, "deviceName": caps["devicename"], "uuid": caps["uuid"], "appPackage": caps["apppackage"], "appActivity": caps["appactivity"] } logger.info('打开 appium 服务,正在配置...') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', self.desired_caps) self.wait = WebDriverWait(self.driver, 10) self.size = self.driver.get_window_size()
Example #14
Source File: whatsapp_add_new_contact_worker.py From whatsapp_automation with GNU General Public License v3.0 | 6 votes |
def setUp(self): "Setup for the test" desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '9' desired_caps['deviceName'] = 'emulator-5554' # Returns abs path relative to this file and not cwd # desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__),'apps/whatsapp.apk')) desired_caps['appPackage'] = 'com.android.contacts' desired_caps['appActivity'] = '.activities.PeopleActivity' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) #self.emulator_name = 'pixel_1' #self.mobile_number = '+91 78386 67436' #self.message_body = 'Hello There!' self.emulator_name = self.emulator_name self.mobile_number = self.mobile_number # self.action = action
Example #15
Source File: conftest.py From poium with Apache License 2.0 | 5 votes |
def app(): global app_driver # APP定义运行环境 desired_caps = { 'deviceName': 'YAL_AL10', 'automationName': 'appium', 'platformName': 'Android', 'platformVersion': '10.0', 'appPackage': 'com.android.calculator2', 'appActivity': '.Calculator', } app_driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) return app_driver
Example #16
Source File: whatsapp_broadcast_message_worker.py From whatsapp_automation with GNU General Public License v3.0 | 5 votes |
def setUp(self): "Setup for the test" desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '9' desired_caps['deviceName'] = 'emulator-5554' # Returns abs path relative to this file and not cwd # desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__),'apps/whatsapp.apk')) desired_caps['appPackage'] = 'com.whatsapp' desired_caps['appActivity'] = '.Main' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) self.emulator_name = self.emulator_name self.mobile_number_list = self.mobile_number_list self.message_body = self.message_body # self.action = action
Example #17
Source File: whatsapp_new_message_listener_worker.py From whatsapp_automation with GNU General Public License v3.0 | 5 votes |
def setUp(self): "Setup for the test" desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '9' desired_caps['deviceName'] = 'emulator-5554' # Returns abs path relative to this file and not cwd # desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__),'apps/whatsapp.apk')) desired_caps['appPackage'] = 'com.whatsapp' desired_caps['appActivity'] = '.Main' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
Example #18
Source File: ios.py From airtest with BSD 3-Clause "New" or "Revised" License | 5 votes |
def _connect(self): return webdriver.Remote( command_executor=self.url, desired_capabilities={ 'platformName': 'iOS' } )
Example #19
Source File: whatsapp_single_message_worker.py From whatsapp_automation with GNU General Public License v3.0 | 5 votes |
def setUp(self): "Setup for the test" desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['platformVersion'] = '9' desired_caps['deviceName'] = 'emulator-5554' # Returns abs path relative to this file and not cwd # desired_caps['app'] = os.path.abspath(os.path.join(os.path.dirname(__file__),'apps/whatsapp.apk')) desired_caps['appPackage'] = 'com.whatsapp' desired_caps['appActivity'] = '.Main' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) self.emulator_name = self.emulator_name self.mobile_number = self.mobile_number self.message_body = self.message_body # self.action = action
Example #20
Source File: test_unittest.py From aws-device-farm-sample-web-app-using-appium-python with Apache License 2.0 | 5 votes |
def setUp(self): desired_caps = {} self.driver = webdriver.Remote( 'http://127.0.0.1:4723/wd/hub', desired_caps)
Example #21
Source File: UIElement.py From AXUI with Apache License 2.0 | 5 votes |
def start(self, **kwargs): ''' get root ready like get root element in windows UIA, get browser to target website must have a "browser_name" argument in kwargs to indicate which browser to use other kwargs are same as normal selenium webdrivers ''' if "command_executor" not in kwargs: #use default command executor kwargs["command_executor"] = 'http://127.0.0.1:4444/wd/hub' self.webdriver = webdriver.Remote(**kwargs)
Example #22
Source File: douyin.py From douyin with MIT License | 5 votes |
def init_device(): desired_caps = {} desired_caps['platformName'] = 'Android' desired_caps['udid'] = "your device" desired_caps['deviceName'] = "devices name" desired_caps['platformVersion'] = "Android Version" desired_caps['appPackage'] = 'com.ss.android.ugc.aweme' desired_caps['appActivity'] = 'com.ss.android.ugc.aweme.main.MainActivity' desired_caps["unicodeKeyboard"] = True desired_caps["resetKeyboard"] = True desired_caps["noReset"] = True desired_caps["newCommandTimeout"] = 600 device = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps) device.implicitly_wait(3) return device
Example #23
Source File: nantian_keyboard.py From tools_python with Apache License 2.0 | 5 votes |
def __init__(self): self.caps = { 'automationName': DRIVER, 'platformName': PLATFORM, 'deviceName': DEVICE_NAME, 'appPackage': APP_PACKAGE, 'appActivity': APP_ACTIVITY, 'platformVersion': ANDROID_VERSION, 'autoGrantPermissions': AUTO_GRANT_PERMISSIONS, 'unicodeKeyboard': True, 'resetKeyboard': True } self.driver = webdriver.Remote(DRIVER_SERVER, self.caps) self.wait = WebDriverWait(self.driver, TIMEOUT)
Example #24
Source File: base_test.py From aws-device-farm-appium-python-tests-for-android-sample-app with Apache License 2.0 | 5 votes |
def setUp(self): """Sets up desired capabilities and the Appium driver.""" url = 'http://127.0.0.1:4723/wd/hub' desired_caps = {} """ The following desired capabilities must be set when running locally. Make sure they are NOT set when uploading to Device Farm. desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = 'aPhone' """ desired_caps['platformName'] = 'Android' desired_caps['deviceName'] = 'aPhone' self.driver = webdriver.Remote(url, desired_caps) self.navigation_page = NavigationPage(self.driver)
Example #25
Source File: test_helper.py From python-client with Apache License 2.0 | 5 votes |
def setup_method(self, method) -> None: # type: ignore desired_caps = desired_capabilities.get_desired_capabilities('ApiDemos-debug.apk.zip') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) if is_ci(): self.driver.start_recording_screen()
Example #26
Source File: find_by_view_matcher_tests.py From python-client with Apache License 2.0 | 5 votes |
def setup_method(self, method) -> None: # type: ignore desired_caps = desired_capabilities.get_desired_capabilities('ApiDemos-debug.apk.zip') desired_caps['automationName'] = 'Espresso' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) if is_ci(): self.driver.start_recording_screen()
Example #27
Source File: find_by_image_tests.py From python-client with Apache License 2.0 | 5 votes |
def setup_method(self) -> None: desired_caps = desired_capabilities.get_desired_capabilities('ApiDemos-debug.apk.zip') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps) # relax template matching self.driver.update_settings({"fixImageFindScreenshotDims": False, "fixImageTemplateSize": True, "autoUpdateImageElementPosition": True})
Example #28
Source File: chrome_tests.py From python-client with Apache License 2.0 | 5 votes |
def setup_method(self) -> None: caps = get_desired_capabilities() caps['browserName'] = 'Chrome' self.driver = webdriver.Remote('http://localhost:4723/wd/hub', caps)
Example #29
Source File: context_switching_tests.py From python-client with Apache License 2.0 | 5 votes |
def setup_method(self) -> None: desired_caps = desired_capabilities.get_desired_capabilities('selendroid-test-app.apk') self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
Example #30
Source File: safari_tests.py From python-client with Apache License 2.0 | 5 votes |
def setup_method(self) -> None: desired_caps = get_desired_capabilities() desired_caps.update({ 'browserName': 'safari', 'nativeWebTap': True, 'safariIgnoreFraudWarning': True }) self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)