python->selenium->msedgedriver->edge

成坤 李 0 Reputation points
2023-06-02T15:57:03.85+00:00

User's image

User's image

Waht should i do?

Microsoft Edge Microsoft Edge development
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-06-05T05:47:43.08+00:00

    Hi @成坤 李,

    This popup is controlled by the setting "Allow Microsoft to save your browsing activity including history, usage, favorites, web content, and other browsing data to personalize Microsoft Edge and Microsoft services like ads, search, shopping and news“. The path is Edge settings --> Privacy, search, and services --> Personalization & advertising. Once it is set ON, there will be no such popup again.

    To achieve it in Python for Selenium tests, you can use the following code:

    from selenium import webdriver
    from selenium.webdriver.edge.options import Options as EdgeOptions
    option = EdgeOptions()
    prefs = {
        'user_experience_metrics': {
            'personalization_data_consent_enabled': True
        }
    }
    option.add_experimental_option('prefs', prefs)
    
    driver = webdriver.Edge(options = option)
    

    Then you won't see this popup in your Selenium test.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Shijie Li

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.