Skip to content

Im getting an error: WebDriver' object has no attribute 'set_settings #1145

@yullyayu01

Description

@yullyayu01

I’m facing an issue where I can’t allow the ___location permission on the simulator. I tried using python. But Im getting error acceptAlertButtonSelector : 'WebDriver' object has no attribute 'set_settings. I’m currently using: Appium 2.19.0 , iOS 18.4 Simulator , robotframework-appiumlibrary 2.1.0, Appium-Python-Client 3.2.1 and Python 3.9.6.

def accept_ios_location_alert():
    success = False

    try:
        appiumlib = BuiltIn().get_library_instance('AppiumLibrary')
        driver = appiumlib._current_application()
        print(f"{driver}")
    except Exception as e:
        print(f"❌ Failed: {e}")
        return False

    try:
        selector = "**/XCUIElementTypeButton['name == \"Allow While Using App\" OR name == \"Allow\"']"
        # driver.execute_script("mobile: setSettings", {
        # "settings": {
        #       "acceptAlertButtonSelector": selector
        #    }
        # })
        driver.set_settings({
            "acceptAlertButtonSelector": selector
        })
        print(f"✅ Setting 'acceptAlertButtonSelector' success di-set: {selector}")
    except Exception as e:
        print(f"❌ Filed set acceptAlertButtonSelector: {e}")
        return False

    time.sleep(3)

    try:
        alert = driver.switch_to.alert
        alert_text = alert.text
        print(f"⚠️ Alert is appears: {alert_text}")
    except:
        print("✅ Alert success dismiss.")
        success = True

    return success

I think possibly python Appium client just does not support it. Any suggestions or best practices would be appreciated. Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions