nateshmbhat / webbot

Web automation library for simple and easy end to end testing and web browser automation that offers super charged features while keeping it simple to use and master
https://pypi.org/project/webbot/
Mozilla Public License 2.0
242 stars 86 forks source link

User Agent settings #60

Open Mykadlo opened 3 years ago

Mykadlo commented 3 years ago

Hello, it would be nice having an option to change user agent when initializing a webdriver.

Can you please add it in next version?

My solution:

    class Browser:
    ...

    :__init__(showWindow = True , proxy = None, userAgent = None):
        ...
        :Args:
            - showWindow : If true , will run a headless browser without showing GUI window.
            - proxy : Url of any optional proxy server.
           - userAgent: userAgent string to be set for browser identification

    ....
    def __init__(self, showWindow=True, proxy=None , downloadPath:str=None, userAgent:str=None ):

        if userAgent:
            options.add_argument("user-agent={}".format(userAgent))