desire已经配置权限'autoGrantPermissions': True,并且手动已经赋予app权限,运行代码后仍app端仍弹出需要获取地理位置信息的弹框

coding=utf-8

import time

import pytest
from appium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait

class TestCs():
def setup(self):
desired_caps = {
‘platformName’: “Android”,
“platformVersion”: “9.0”,
‘deviceName’: “Q5S5T19620006140”,
‘browserName’: “Chrome”,
‘autoGrantPermissions’: True,
“automationName”: “UiAutomator2”,
“noReset”:False,
“dontStopAppOnReset”:True

    }
    self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)
    time.sleep(1)



def test_webview(self):
    url = "http://www.baidu.com"

    self.driver.get(url=url)

    WebDriverWait(self.driver, 15).until(expected_conditions.visibility_of_element_located((By.NAME, "word")))

    self.driver.find_element_by_name("word").send_keys("appium")

    print(self.driver.contexts)

    self.driver.switch_to.context(self.driver.contexts[0])

    self.driver.find_element_by_id("android:id/button2").click()


def teardown(self):

    time.sleep(20)


    self.driver.quit()

“noReset”:False ,你手动允许权限,然后改成 true就行了;autoGrantPermissions这个参数对于有些权限不好使

这样不行呀,我运行脚本前已经手动赋予权限,但是运行脚本时还是会弹出对应权限的弹框,再去查看手机设置里的权限,之前手动赋予的权限已经被关闭