Python – AttributeError: объект «WebDriver» не имеет атрибута «launch_app» ⇐ Python
Python – AttributeError: объект «WebDriver» не имеет атрибута «launch_app»
Я работаю с Appium Android, но постоянно получаю это сообщение об ошибке.
E AttributeError: объект WebDriver не имеет атрибута launch_app
Та же проблема возникает с close() ** Ниже мой файл conftest.py**
импортировать pytest импортировать очарование из allure_commons.types импорт AttachmentType из веб-драйвера импорта Appium из appium.webdriver.common.appiumby импортировать AppiumBy из appium.options.android импортировать UiAutomator2Options appium_server = "http://localhost:4723/wd/hub" желаемый_cap = { # Эмулятор - Android "deviceName": "Nexus 4 API 30", "platformName": "Android", "platformVersion": "11.0", "udid": "эмулятор-5554", "appPackage": "com.epf.mip.uat", "appActivity": "com.epf.mip.uat.MainActivity" } # Преобразует возможности в экземпляр AppiumOptions options_options = UiAutomator2Options().load_capabilities(desired_cap) @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_makereport(пункт, вызов): результат = доходность представитель = result.get_result() setattr(item, "rep_" + Rep.When, Rep) возврат представителя @pytest.fixture() защита appium_android_driver (запрос): print("Инициализация драйвера Appium Android") драйвер = webdriver.Remote(command_executor=appium_server, options=capabilities_options) драйвер доходности если request.node.rep_call.failed: allure.attach(driver.get_screenshot_as_png(), name="Экран перед ошибкой", Attachment_type=AttachmentType.PNG) драйвер.выйти() Ниже приведен мой тестовый код:
def __init__(self, appium_android_driver): self.driver = appium_android_driver защита launching_iAkaun_Application (драйвер): driver.launch_app() . . Ниже приведен основной код: импортировать pytest из appium.webdriver.appium_service импортировать AppiumService appium_service = AppiumService()
@pytest.mark.usefixtures("appium_android_driver") класс TestSuite_EPF_Android_App: def test_initialAppLaunch(self, appium_android_driver): запуск_iAkaun_Application(self.driver) Я использую Selenium 4.14.0, pytest 7.4.3, Appium Python Client 3.1.0
Мне нужно приложение launch_app для закрытия и повторного открытия драйвера. Чтобы я мог вызывать тестовые примеры из Excel.
Я работаю с Appium Android, но постоянно получаю это сообщение об ошибке.
E AttributeError: объект WebDriver не имеет атрибута launch_app
Та же проблема возникает с close() ** Ниже мой файл conftest.py**
импортировать pytest импортировать очарование из allure_commons.types импорт AttachmentType из веб-драйвера импорта Appium из appium.webdriver.common.appiumby импортировать AppiumBy из appium.options.android импортировать UiAutomator2Options appium_server = "http://localhost:4723/wd/hub" желаемый_cap = { # Эмулятор - Android "deviceName": "Nexus 4 API 30", "platformName": "Android", "platformVersion": "11.0", "udid": "эмулятор-5554", "appPackage": "com.epf.mip.uat", "appActivity": "com.epf.mip.uat.MainActivity" } # Преобразует возможности в экземпляр AppiumOptions options_options = UiAutomator2Options().load_capabilities(desired_cap) @pytest.hookimpl(hookwrapper=True, tryfirst=True) def pytest_runtest_makereport(пункт, вызов): результат = доходность представитель = result.get_result() setattr(item, "rep_" + Rep.When, Rep) возврат представителя @pytest.fixture() защита appium_android_driver (запрос): print("Инициализация драйвера Appium Android") драйвер = webdriver.Remote(command_executor=appium_server, options=capabilities_options) драйвер доходности если request.node.rep_call.failed: allure.attach(driver.get_screenshot_as_png(), name="Экран перед ошибкой", Attachment_type=AttachmentType.PNG) драйвер.выйти() Ниже приведен мой тестовый код:
def __init__(self, appium_android_driver): self.driver = appium_android_driver защита launching_iAkaun_Application (драйвер): driver.launch_app() . . Ниже приведен основной код: импортировать pytest из appium.webdriver.appium_service импортировать AppiumService appium_service = AppiumService()
@pytest.mark.usefixtures("appium_android_driver") класс TestSuite_EPF_Android_App: def test_initialAppLaunch(self, appium_android_driver): запуск_iAkaun_Application(self.driver) Я использую Selenium 4.14.0, pytest 7.4.3, Appium Python Client 3.1.0
Мне нужно приложение launch_app для закрытия и повторного открытия драйвера. Чтобы я мог вызывать тестовые примеры из Excel.
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
AttributeError: объект «WebDriver» не имеет атрибута «find_element_by_xpath»
Anonymous » » в форуме Python - 0 Ответы
- 54 Просмотры
-
Последнее сообщение Anonymous
-
-
-
AttributeError: объект «WebDriver» не имеет атрибута «find_element_by_class_name»
Anonymous » » в форуме Python - 0 Ответы
- 29 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Dipy — ошибка атрибута: AttributeError: модуль «numpy» не имеет атрибута «float»
Anonymous » » в форуме Python - 0 Ответы
- 30 Просмотры
-
Последнее сообщение Anonymous
-