Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to make it work on Linux ARM64? #225

Open
CtrlValCanc opened this issue Nov 19, 2024 · 6 comments
Open

Is there a way to make it work on Linux ARM64? #225

CtrlValCanc opened this issue Nov 19, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@CtrlValCanc
Copy link

Is your feature request related to a problem? Please describe.
I can't use it on my Armbian Linux ARM64 installation as there is no chrome release. I tried downloading chromium and chromium driver, but I don't know how to implement it into code

Describe the solution you'd like
I would like to use Chromium and Chromium browser as it seems the easier solution

error:

2024-11-19 22:14:53,890 [DEBUG] in __init__
2024-11-19 22:14:54,189 [WARNING] Returning default
Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 199, in getCCodeLang
    nfo = ipapi.location()
          ^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/ipapi/ipapi.py", line 87, in location
    raise RateLimited(data)
ipapi.exceptions.RateLimited: {'error': True, 'reason': 'RateLimited', 'message': 'Visit https://ipapi.co/ratelimited/ for details'}
2024-11-19 22:14:54,572 [ERROR]
Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/common/driver_finder.py", line 67, in _binary_paths
    output = SeleniumManager().binary_paths(self._to_args())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/common/selenium_manager.py", line 47, in binary_paths
    args = [str(self._get_binary())] + args
                ^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/common/selenium_manager.py", line 94, in _get_binary
    raise WebDriverException(f"Unsupported platform/architecture combination: {sys.platform}/{arch}")
selenium.common.exceptions.WebDriverException: Message: Unsupported platform/architecture combination: linux/aarch64


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/main.py", line 40, in main
    earned_points = executeBot(currentAccount, args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/main.py", line 235, in executeBot
    with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 52, in __init__
    self.webdriver = self.browserSetup()
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 104, in browserSetup
    version = self.getChromeVersion()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 215, in getChromeVersion
    driver = WebDriver(options=chrome_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 50, in __init__
    if finder.get_browser_path():
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/common/driver_finder.py", line 47, in get_browser_path
    return self._binary_paths()["browser_path"]
           ^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/venv/lib/python3.11/site-packages/selenium/webdriver/common/driver_finder.py", line 78, in _binary_paths
    raise NoSuchDriverException(msg) from err
selenium.common.exceptions.NoSuchDriverException: Message: Unable to obtain driver for chrome; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location

2024-11-19 22:14:54,595 [WARNING] config-private.yaml doesn't exist
2024-11-19 22:14:54,596 [DEBUG] No urls found, not sending notification
2024-11-19 22:14:54,599 [INFO] [POINTS] Data saved for the next day.
@CtrlValCanc CtrlValCanc added the enhancement New feature or request label Nov 19, 2024
@28Black
Copy link

28Black commented Nov 24, 2024

Sure, should be solved by following my instructions here. Hope you can sort it out with this :)

@CtrlValCanc
Copy link
Author

CtrlValCanc commented Nov 24, 2024

Sure, should be solved by following my instructions here. Hope you can sort it out with this :)

Hi! First of all, thank you for your answer, I searched for my issue and I could not find your solution, my bad.

LEAVING THIS IF SOMEONE ELSE STUMBLES, but it was a really stupid mistake.
I chose an account to test that I hadn't logged in quite a while. I logged in on my browser and I just had to accept the new terms of Microsoft.
Now it's working.
THANK YOU!!!

But it seems like I'm having some problems that I'm not able to understand/fix.

I don't know if it could be an issue, but on my armbian installation the package chromium-chromedriver could not be found, I installed chromium-driver instead. Also, I do not have a DE installed on my device, I don't know if it could be a problem. bing is the user I am on (created ad hoc for this bot)

I had to manually create with mkdir the folder home/bing/.local/share/undetected_chromedriver/ and home/bing/.local/share/undetected_chromedriver/chromedriver_copy

$ ls ~/.local/share/undetected_chromedriver/chromedriver_copy
chromedriver

I use zsh, but it should not be a problem, instead of editing .bshrc I edited .zshrc

$ echo $PATH
/home/bing/.local/share/undetected_chromedriver/chromedriver_copy

I edited driver_finder.py, so the section looks like that

    def __init__(self, service: Service, options: BaseOptions) -> None:
        self._service = service
        self._options = options
        self._paths = {"driver_path": "/home/bing/.local/share/undetected_chromedriver/chromedriver_copy/chromedriver", "browser_path": ""}

But I think there are more than one thing wrong. Here the ouput:

2024-11-24 11:59:37,002 [DEBUG] in __init__
2024-11-24 11:59:46,221 [INFO] Screen size: 1352x1042
2024-11-24 11:59:46,228 [INFO] Device size: 1297x891
2024-11-24 11:59:48,020 [DEBUG] out __init__
2024-11-24 11:59:48,022 [DEBUG] in __enter__
2024-11-24 12:00:10,820 [INFO] [LOGIN] Logging-in...
2024-11-24 12:00:11,053 [INFO] [LOGIN] Entering email...
2024-11-24 12:00:24,678 [DEBUG] isPasswordless = False
2024-11-24 12:00:24,955 [INFO] [LOGIN] Entering password...
2024-11-24 12:00:46,713 [DEBUG] isDeviceAuthEnabled = False
2024-11-24 12:00:48,058 [DEBUG] isTOTPEnabled = False
2024-11-24 12:00:58,349 [DEBUG] in __exit__ exc_type=<class 'selenium.common.exceptions.TimeoutException'> exc_value=Message: 
Stacktrace:
#0 0xaaaaeac82b50 <unknown>
#1 0xaaaaea7fffe4 <unknown>
#2 0xaaaaea841f34 <unknown>
#3 0xaaaaea881a3c <unknown>
#4 0xaaaaea8379b0 <unknown>
#5 0xaaaaea8386c8 <unknown>
#6 0xaaaaeac56958 <unknown>
#7 0xaaaaeac59948 <unknown>
#8 0xaaaaeac5952c <unknown>
#9 0xaaaaeac48640 <unknown>
#10 0xaaaaeac59f84 <unknown>
#11 0xaaaaeac330a0 <unknown>
#12 0xaaaaeac72404 <unknown>
#13 0xaaaaeac725ec <unknown>
#14 0xaaaaeac81b44 <unknown>
#15 0xffff9923ee8c <unknown>
#16 0xffff992a7b18 <unknown>
 traceback=<traceback object at 0xffff9c65ef80>
2024-11-24 12:00:58,503 [ERROR] 
Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/main.py", line 40, in main
    earned_points = executeBot(currentAccount, args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/main.py", line 237, in executeBot
    Login(desktopBrowser, args).login()
  File "/home/bing/MS-Rewards-Farmer/src/login.py", line 30, in login
    self.executeLogin()
  File "/home/bing/MS-Rewards-Farmer/src/login.py", line 128, in executeLogin
    self.utils.waitUntilVisible(By.NAME, "kmsiForm")
  File "/home/bing/MS-Rewards-Farmer/src/utils.py", line 74, in waitUntilVisible
    return WebDriverWait(self.webdriver, timeToWait).until(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 105, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message: 
Stacktrace:
#0 0xaaaaeac82b50 <unknown>
#1 0xaaaaea7fffe4 <unknown>
#2 0xaaaaea841f34 <unknown>
#3 0xaaaaea881a3c <unknown>
#4 0xaaaaea8379b0 <unknown>
#5 0xaaaaea8386c8 <unknown>
#6 0xaaaaeac56958 <unknown>
#7 0xaaaaeac59948 <unknown>
#8 0xaaaaeac5952c <unknown>
#9 0xaaaaeac48640 <unknown>
#10 0xaaaaeac59f84 <unknown>
#11 0xaaaaeac330a0 <unknown>
#12 0xaaaaeac72404 <unknown>
#13 0xaaaaeac725ec <unknown>
#14 0xaaaaeac81b44 <unknown>
#15 0xffff9923ee8c <unknown>
#16 0xffff992a7b18 <unknown>

2024-11-24 12:00:58,546 [WARNING] config-private.yaml doesn't exist
2024-11-24 12:00:58,547 [DEBUG] No urls found, not sending notification
2024-11-24 12:00:58,551 [INFO] [POINTS] Data saved for the next day.

Thank you again.

@28Black
Copy link

28Black commented Nov 25, 2024

You're welcome, I'm happy it works now 👍
Keep in mind to "update" the chromium driver regularly if there are new updates. I'll share my script with you and maybe others who read this, which automates the copying easily if an update of chromium driver was installed to the system. Please keep in mind to modify it to your actual paths, chromium driver name and also to make it executable (chmod +x).
You don't really need the dialogs, I have it since it's part of my superordinate script to update and run the whole Farmer. You can run it manually or automatically with a cronjob.

#!/bin/bash

# Ask whether to check for updates, with an automatic "yes" selection after 10 seconds
read -t 10 -p "Do you want to check for Chromedriver updates? (Yes/No, default: No): " choice
choice=${choice:-y}  # If no input is given, set choice to "y"
case "$choice" in 
  [Yy]* ) 
    echo "Checking for Chromedriver updates..."
    # Save the current hash of the Chromedriver
    OLD_CHROMEDRIVER_HASH=$(md5sum /home/YOURNAME/.local/share/undetected_chromedriver/chromedriver_copy/chromedriver | awk '{print $1}')

    # Save the new hash of the requirements.txt
    NEW_CHROMEDRIVER_HASH=$(md5sum /usr/bin/chromedriver | awk '{print $1}')

    # Compare the hashes and update only if there are changes
    if [ "$OLD_CHROMEDRIVER_HASH" != "$NEW_CHROMEDRIVER_HASH" ]; then
        echo "Chromedriver has changed. Deploying the new version..."
        cp -f /usr/bin/chromedriver /home/YOURNAME/.local/share/undetected_chromedriver/chromedriver_copy
    else
        echo "Chromedriver is unchanged. No action required."
    fi
    ;;
  [Nn]* ) 
    echo "Skipping Chromedriver update check."
    ;;
  * ) 
    echo "Invalid input. Skipping Chromedriver update check."
    ;;
esac

# Keeping the terminal open for verification
echo -e "\n\033[32mThe script was executed.\033[0m"
exec $SHELL

@CtrlValCanc
Copy link
Author

CtrlValCanc commented Nov 26, 2024

2024-11-26 12:55:54,379 [DEBUG] in __init__
2024-11-26 12:55:59,215 [ERROR] 
Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/main.py", line 40, in main
    earned_points = executeBot(currentAccount, args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/main.py", line 235, in executeBot
    with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 52, in __init__
    self.webdriver = self.browserSetup()
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 106, in browserSetup
    version = self.getChromeVersion()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 222, in getChromeVersion
    driver = WebDriver(options=chrome_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 238, in __init__
    self.start_session(capabilities)
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 325, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 380, in execute
    self.error_handler.check_response(response)
  File "/home/bing/MS-Rewards-Farmer/.env/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: disconnected: Unable to receive message from renderer
  (failed to check if window was closed: disconnected: not connected to DevTools)
  (Session info: chrome=131.0.6778.85)
Stacktrace:
#0 0xaaaacf77cec0 <unknown>
#1 0xaaaacf2f4ef0 <unknown>
#2 0xaaaacf2e26f8 <unknown>
#3 0xaaaacf2e2544 <unknown>
#4 0xaaaacf2e079c <unknown>
#5 0xaaaacf2e0a88 <unknown>
#6 0xaaaacf2e7a98 <unknown>
#7 0xaaaacf2df6c4 <unknown>
#8 0xaaaacf2e222c <unknown>
#9 0xaaaacf2e079c <unknown>
#10 0xaaaacf2e0a88 <unknown>
#11 0xaaaacf2d8c14 <unknown>
#12 0xaaaacf2df6c4 <unknown>
#13 0xaaaacf2df1e8 <unknown>
#14 0xaaaacf2dee28 <unknown>
#15 0xaaaacf2f771c <unknown>
#16 0xaaaacf2d32b4 <unknown>
#17 0xaaaacf2d2b20 <unknown>
#18 0xaaaacf368ba0 <unknown>
#19 0xaaaacf368360 <unknown>
#20 0xaaaacf32dde0 <unknown>
#21 0xaaaacf32eaf8 <unknown>
#22 0xaaaacf750b6c <unknown>
#23 0xaaaacf753b38 <unknown>
#24 0xaaaacf753704 <unknown>
#25 0xaaaacf742840 <unknown>
#26 0xaaaacf754170 <unknown>
#27 0xaaaacf72d580 <unknown>
#28 0xaaaacf76c5f8 <unknown>
#29 0xaaaacf76c7e0 <unknown>
#30 0xaaaacf77be8c <unknown>
#31 0xffff8726ee8c <unknown>
#32 0xffff872d7b18 <unknown>

2024-11-26 12:55:59,264 [WARNING] config-private.yaml doesn't exist
2024-11-26 12:55:59,266 [DEBUG] No urls found, not sending notification
2024-11-26 12:55:59,277 [INFO] [POINTS] Data saved for the next day.

Do you know why it stopped working?

@CtrlValCanc CtrlValCanc reopened this Nov 26, 2024
@28Black
Copy link

28Black commented Nov 27, 2024

Verify that the path to the chromium driver is still set in selenium. It gets reset every time the dependencies i.e. selenium gets updated.
Also, try to rename (/remove) the sessions folder.

@CtrlValCanc
Copy link
Author

CtrlValCanc commented Dec 4, 2024

Thank you for your answer. I'm still having problems (I reallt don't know why).
First thing I had to do was to edit self._paths = {"driver_path": "/home/YOURNAME/.local/share/undetected_chromedriver/chromedriver_copy/_chromedriver_", "browser_path": ""} to self._paths = {"driver_path": "/home/YOURNAME/.local/share/undetected_chromedriver/chromedriver_copy", "browser_path": ""}, so I had to remove chromedriver from the path as it was searching the folder and not the executable.
I:

  • deleted and re-cloned the repo
  • deleted and re-installed the virtual enviroment (and did some edits)
  • deleted sessions folder after trying
  • reinstalled chromium and chromium-driver
  • checked if chromium and chromium-driver are the same version
    chromium --version: Chromium 131.0.6778.85 built on Debian GNU/Linux 12 (bookworm)
    chromedriver --version: ChromeDriver 131.0.6778.85 (3d81e41b6f3ac8bcae63b32e8145c9eb0cd60a2d-refs/branch-heads/6778@{#2285})

The error is still the same:

2024-12-04 15:46:31,183 [ERROR]
Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/main.py", line 40, in main
    earned_points = executeBot(currentAccount, args)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/main.py", line 235, in executeBot
    with Browser(mobile=False, account=currentAccount, args=args) as desktopBrowser:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 52, in __init__
    self.webdriver = self.browserSetup()
                     ^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 106, in browserSetup
    version = self.getChromeVersion()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 222, in getChromeVersion
    driver = WebDriver(options=chrome_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in __init__
    self.start_session(capabilities)
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 329, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 384, in execute
    self.error_handler.check_response(response)
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: disconnected: Unable to receive message from renderer
  (failed to check if window was closed: disconnected: not connected to DevTools)
  (Session info: chrome=131.0.6778.85)
Stacktrace:
#0 0xaaaab81ccec0 <unknown>
#1 0xaaaab7d44ef0 <unknown>
#2 0xaaaab7d326f8 <unknown>
#3 0xaaaab7d32544 <unknown>
#4 0xaaaab7d3079c <unknown>
#5 0xaaaab7d30a88 <unknown>
#6 0xaaaab7d37a98 <unknown>
#7 0xaaaab7d2f6c4 <unknown>
#8 0xaaaab7d3222c <unknown>
#9 0xaaaab7d3079c <unknown>
#10 0xaaaab7d30a88 <unknown>
#11 0xaaaab7d28c14 <unknown>
#12 0xaaaab7d2f6c4 <unknown>
#13 0xaaaab7d2f1e8 <unknown>
#14 0xaaaab7d2ee28 <unknown>
#15 0xaaaab7d4771c <unknown>
#16 0xaaaab7d232b4 <unknown>
#17 0xaaaab7d22b20 <unknown>
#18 0xaaaab7db8ba0 <unknown>
#19 0xaaaab7db8360 <unknown>
#20 0xaaaab7d7dde0 <unknown>
#21 0xaaaab7d7eaf8 <unknown>
#22 0xaaaab81a0b6c <unknown>
#23 0xaaaab81a3b38 <unknown>
#24 0xaaaab81a3704 <unknown>
#25 0xaaaab8192840 <unknown>
#26 0xaaaab81a4170 <unknown>
#27 0xaaaab817d580 <unknown>
#28 0xaaaab81bc5f8 <unknown>
#29 0xaaaab81bc7e0 <unknown>
#30 0xaaaab81cbe8c <unknown>
#31 0xffffb0b5ee8c <unknown>
#32 0xffffb0bc7b18 <unknown>

Now I also think I reached ipapi limit because it gives this other error before the one I posted

Traceback (most recent call last):
  File "/home/bing/MS-Rewards-Farmer/src/browser.py", line 206, in getCCodeLang
    nfo = ipapi.location()
          ^^^^^^^^^^^^^^^^
  File "/home/bing/MS-Rewards-Farmer/.venv/lib/python3.11/site-packages/ipapi/ipapi.py", line 87, in location
    raise RateLimited(data)
ipapi.exceptions.RateLimited: {'error': True, 'reason': 'RateLimited', 'message': 'Visit https://ipapi.co/ratelimited/ for details'}
[the rest of the error]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants