1

a friend of mine wrote me a piece of code which does a web automation for me which im running on a VPS.

On VPS 1 the script has been running for days without a problem. Now I wanted to do the same on a different VPS. Its an older windows version of win 10 I don't know if that plays a role*

Chrome version on VPS 1 is 102 If I try to install chrome on VPS 2 it updates automatically to 103 so I tried downloaded version 102 over this link : https://www.slimjet.com/chrome/google-chrome-old-version.php but it still auto updates to 103 so i ended up running the 103 chrome driver instead of the 102 on VPS1

For the rest I installed everything completely the same on VPS 1 on VPS2

Selenium version 4.1.5

But now all it does it that it opens the browser with the link but it doesn't do any actions and I don't know what the error means. I will put the code in here (some things censored because of personal information) + the error I get


import schedule
import time
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains

exec_times = ["13:17"]
wert = "5"
id = "ID: CENSORED"


def do_purchase():
    PATH = "C:\\Users\\Administrator\\Desktop\\bumping\\chromedriver.exe"
    URL = "URL CENSORED"

    options = Options()
    options.add_argument(
        "user-data-dir=C:\\Users\\\Administrator\\AppData\\Local\\Google\\Chrome\\User Data")
    driver = webdriver.Chrome(PATH, chrome_options=options)
    driver.get(URL)

    time.sleep(10)

    div = div = driver.find_element_by_xpath(
        "//*[contains(text(), '{}')]".format(id))
    parent = div.find_element_by_xpath('..')
    buttons = parent.find_elements_by_tag_name('button')
    button = buttons[0]

    hover = ActionChains(driver).move_to_element(parent)
    hover.perform()

    time.sleep(2)
    webdriver.ActionChains(driver).move_to_element(
        button).click(button).perform()

    time.sleep(3)

    inputs = driver.find_elements_by_xpath(
        "//*[contains(text(), 'Transfer amount')]")
    parent = inputs[0].find_element_by_xpath('..')
    input = parent.find_element_by_tag_name('input')
    input.clear()
    input.send_keys(wert)

    confirm_span = driver.find_element_by_xpath(
        "//*[contains(text(), 'Confirm')]")
    confirm_button = confirm_span.find_element_by_xpath('..')
    webdriver.ActionChains(driver).move_to_element(
        confirm_button).click(confirm_button).perform()

    time.sleep(5)
    driver.quit()


def task(time):
    do_purchase()
    


for exec_time in exec_times:
    schedule.every().day.at(exec_time).do(task, exec_time)

while True:
    schedule.run_pending()
    time.sleep(1)

The terminal says the following



PS C:\Users\Administrator> & C:/Users/Administrator/AppData/Local/Programs/Python/Python310/python.exe "c:/Users/Administrator/Desktop/bumping/Client 1.py"
c:\Users\Administrator\Desktop\bumping\Client 1.py:19: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
  driver = webdriver.Chrome(PATH, chrome_options=options)
c:\Users\Administrator\Desktop\bumping\Client 1.py:19: DeprecationWarning: use options instead of chrome_options
  driver = webdriver.Chrome(PATH, chrome_options=options)

DevTools listening on ws://127.0.0.1:64181/devtools/browser/854481e2-f194-46a1-8421-8dab5852169d
Traceback (most recent call last):
  File "c:\Users\Administrator\Desktop\bumping\Client 1.py", line 65, in <module>
    schedule.run_pending()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\schedule\__init__.py", line 780, in run_pending
    default_scheduler.run_pending()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\schedule\__init__.py", line 100, in run_pending
    self._run_job(job)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\schedule\__init__.py", line 172, in _run_job
    ret = job.run()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\schedule\__init__.py", line 661, in run
    ret = self.job_func()
  File "c:\Users\Administrator\Desktop\bumping\Client 1.py", line 57, in task
    do_purchase()
  File "c:\Users\Administrator\Desktop\bumping\Client 1.py", line 20, in do_purchase
    driver.get(URL)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 442, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 430, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: cannot determine loading status
from unknown error: unexpected command response
  (Session info: chrome=103.0.5060.53)
Stacktrace:
Backtrace:
        Ordinal0 [0x0060D953+2414931]
        Ordinal0 [0x0059F5E1+1963489]
        Ordinal0 [0x0048C6B8+837304]
        Ordinal0 [0x0047EB34+781108]
        Ordinal0 [0x0047E06A+778346]
        Ordinal0 [0x0047D646+775750]
        Ordinal0 [0x0047C565+771429]
        Ordinal0 [0x0047CB68+772968]
        Ordinal0 [0x0048785F+817247]
        Ordinal0 [0x0049255B+861531]
        Ordinal0 [0x00494F70+872304]
        Ordinal0 [0x0047CE36+773686]
        Ordinal0 [0x00492197+860567]
        Ordinal0 [0x004E4B55+1198933]
        Ordinal0 [0x004D42B6+1131190]
        Ordinal0 [0x004AE860+976992]
        Ordinal0 [0x004AF756+980822]
        GetHandleVerifier [0x0087CC62+2510274]
        GetHandleVerifier [0x0086F760+2455744]
        GetHandleVerifier [0x0069EABA+551962]
        GetHandleVerifier [0x0069D916+547446]
        Ordinal0 [0x005A5F3B+1990459]
        Ordinal0 [0x005AA898+2009240]
        Ordinal0 [0x005AA985+2009477]
        Ordinal0 [0x005B3AD1+2046673]
        BaseThreadInitThunk [0x750D62C4+36]
        RtlSubscribeWnfStateChangeNotification [0x77E20969+1081]
        RtlSubscribeWnfStateChangeNotification [0x77E20934+1028]

Help would be hugely appreciated

  • Hmm... you have two different machines, with different operating systems, different base packages, no info on how you installed your program or which packages/versions have been installed - and you think this is enough information for someone to know what the problem is..? Good job on including the traceback though :-) (`python -V`, `pip -V`, `pip list` to get version info, but without the same foundation to build on it's going to be a guessing game -- can you upgrade the other machine to 103?) – thebjorn Jun 26 '22 at 19:36
  • we can't run it on your computers, and we can't read in your mind - you have to describe all details in question. – furas Jun 26 '22 at 20:57
  • error doesn't show any problem with wrong version of browser. It only show that it can't get response from server. Maybe web page detectec Selenium and it blocks access – furas Jun 26 '22 at 21:00
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Jun 26 '22 at 21:27
  • https://stackoverflow.com/questions/64717302/deprecationwarning-executable-path-has-been-deprecated-selenium-python both of these errors should be handled by the single line. driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options). It also deals with chrome versions so you don't need to worry about executable paths, – Arundeep Chohan Jun 27 '22 at 05:11

0 Answers0