fairgame icon indicating copy to clipboard operation
fairgame copied to clipboard

Pi ChromeDriver issues

Open IrealiTY opened this issue 4 years ago • 10 comments

Tried running the newly added Pi instructions with the following error:

(nvidia-bot) pi@raspberry:~/nvidia-bot $ python app.py nvidia
? What GPU are you after?  3080
? What locale shall we use?  de_de
INFO: "2020-09-23 17:47:42,111 - Initializing notification handlers
INFO: "2020-09-23 17:47:42,116 - Enabled Handlers: ['Twilio', 'Discord']
INFO: "2020-09-23 17:47:42,117 - Opening Webdriver
Traceback (most recent call last):
  File "app.py", line 5, in <module>
    cli.main()
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/pi/nvidia-bot/cli/cli.py", line 32, in nvidia
    nv = NvidiaBuyer(gpu, locale)
  File "/home/pi/nvidia-bot/stores/nvidia.py", line 250, in __init__
    executable_path=binary_path, options=options, chrome_options=chrome_options
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/home/pi/.local/share/virtualenvs/nvidia-bot-sZLTGFwe/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

I did change the line in service.py to self.path = "chromedriver"

IrealiTY avatar Sep 23 '20 15:09 IrealiTY

Hey, maybe @InsanityOnABun can help you out with this.

Hari-Nagarajan avatar Sep 23 '20 15:09 Hari-Nagarajan

Update and try with the --headless flag.

mihaiparvu avatar Sep 23 '20 21:09 mihaiparvu

Does this only happen on the nvidia bot, or have you tried others and run into the same issue?

InsanityOnABun avatar Sep 23 '20 21:09 InsanityOnABun

Thanks for your replies.

I didn't have time to check anything but Nvidia back then (since none of them was relevant to me in Germany).

I will check the headless in a min.

EDIT: Headless gets stuck on INFO: "2020-09-23 23:52:20,317 - Getting product IDs

But I imagine it has to do with the recent backend changes.

IrealiTY avatar Sep 23 '20 21:09 IrealiTY

I added these params to get it to run headless

chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--no-sandbox") # linux only
chrome_options.add_argument("--headless")

It ran once up to captcha point (Amazon) failed and then I restarted the bot and it never proceeded past 'Waiting for home page'.

joseph-tobin avatar Oct 11 '20 22:10 joseph-tobin

Same problem here with Ubuntu 16.04. Stuck on waiting for home page. Where didi you add the chromedriver parameters?

LgWagon avatar Dec 12 '20 10:12 LgWagon

I was able to get the bot running successfully in headless mode by manually specifying the user-data-dir chromedriver argument.

Line 252 in stores/amazon.py:

options.add_argument(f"user-data-dir=.profile-amz")

to, e.g.,

options.add_argument("--user-data-dir=/path/to/fairgame/.profile-amz")

That's what was preventing the webdriver from doing anything on my end. Haven't tried with BB, just Amazon.

lazlod avatar Dec 14 '20 02:12 lazlod

Ok, did you test if the auto-buy process terminates correctly? The only option I saw was to install a desktop environment, i.e. XFCE (working).

LgWagon avatar Dec 14 '20 06:12 LgWagon

did you test if the auto-buy process terminates correctly?

Yep, everything works end to end for me. Running the script (one instance, at least) with the following options:

--headless --disable-presence --no-screenshots --no-image

Edit: also on Pi OS, August release.

lazlod avatar Dec 14 '20 12:12 lazlod

This has all since been fixed and should be fine to work with as of main version 0.6.0

NSCnbot avatar Feb 20 '21 05:02 NSCnbot