omkarcloud / botasaurus

The All in One Framework to build Awesome Scrapers.
https://www.omkar.cloud/botasaurus/
MIT License
1.14k stars 103 forks source link

Having error while adding user_agent or window_size due to add_argument is none. #122

Closed eyoong43 closed 1 month ago

eyoong43 commented 1 month ago

Hi I am having error when adding either user_agent or window_size and I had checked should you add_arguments need to add some check if it is None then you need to declare as empty array?

eyoong43 commented 1 month ago

For appopariate fix should be this at browser_decorator.py

add_arguments: Optional[Union[List[str], Callable[[Any, List[str]], None]]] = [],

sdv75 commented 1 month ago

image

This exception when I add window_size=WindowSize.HASHED

Chetan11-dev commented 1 month ago

Please run the following commands:

python -m pip install bota botasaurus botasaurus_api botasaurus_driver bota botasaurus-proxy-authentication botasaurus_server --upgrade

And then test with

from botasaurus.browser import browser, Driver
from botasaurus.user_agent import UserAgent
from botasaurus.window_size import WindowSize

@browser(
    user_agent=UserAgent.RANDOM,
    window_size=WindowSize.RANDOM,
)
def visit_whatsmyua(driver: Driver, data):
    driver.get("https://www.whatsmyua.info/")
    driver.prompt()

visit_whatsmyua()