Cannot locate elements using headless mode Selenium

后端 未结 1 1087
借酒劲吻你
借酒劲吻你 2021-01-27 18:44

I cannot locate elements using headless mode because of this restriction \"All users will have to use google Chrome when accessing our sites.\" This restriction was added by our

相关标签:
1条回答
  • 2021-01-27 19:41

    Update

    if you wish to bypass the headless agent footprint attach following argument:

    --user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.50 Safari/537.36

    Note: any version you apply to the user-agent argument will be displayed in the request header information.


    ...or speak with the 'admins' of your project so they can include the headless chrome agent to the white-list.

    Here is a normal agent information from chrome:

    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36

    Here is the headless chrome

    User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/69.0.3497.100 Safari/537.36

    As you can see the headless chrome agent is called: HeadlessChrome

    0 讨论(0)
提交回复
热议问题