AttributeError: 'NoneType' object has no attribute 'to_capabilities'
def test_driver(): from appium import webdriver appium_server_url = 'http://localhost:4723' capabilities = { 'platformName': 'Android', 'automationName': 'uiautomator2', 'deviceName': '127.0.0.1:62001', 'appPackage': 'com.android.settings', 'appActivity': '.Settings', } webdriver.Remote(appium_server_url, capabilities)
执行test_driver()后,报错:AttributeError: 'NoneType' object has no attribute 'to_capabilities'
解决办法
def test_driver(): from appium import webdriver from appium.options.android import UiAutomator2Options appium_server_url = 'http://localhost:4723' capabilities = { 'platformName': 'Android', 'automationName': 'uiautomator2', 'deviceName': '127.0.0.1:62001', 'appPackage': 'com.android.settings', 'appActivity': '.Settings', } options = UiAutomator2Options().load_capabilities(capabilities) webdriver.Remote(command_executor=appium_server_url, options=options)