2

The code which works fine locally is throwing an error when instance is created at AWS,I am very novice at it ,I have installed chrome driver and chrome in the instance..any help is highly appreciated below is the code until error

import logging
from kiteconnect import KiteConnect
from datetime import datetime,timedelta
import pandas as pd
from time import sleep
from selenium import webdriver

import undetected_chromedriver as uc
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

import pyotp
driver=uc.Chrome()

error is "selenium.common.exceptions.WebDriverException: Message: unknown error: cannot connect to chrome at 127.0.0.1:41187 from chrome not reachable"

Deadsshott
  • 23
  • 3
  • What is the error? – Ermiya Eskandary Feb 27 '22 at 19:45
  • updated the error – Deadsshott Feb 27 '22 at 19:53
  • Hay, did you ever manage to solve this problem? I'm running a uc in a docker container on AWS ECS and whilst everything works when I run the container locally, on AWS I always get that error... Edit: Weirdly enough 'normal' Selenium works fine, its only uc – Sokker Oct 20 '22 at 08:21
  • Were you able to solve it? I am trying to do the same, but also wondering if the browser is not correct (I'm using this one https://github.com/adieuadieu/serverless-chrome). But I get the same error as you. I'm using "version_main" to make sure it downloads the correct driver but nothing – Otto Gutierrez Dec 15 '22 at 06:37

2 Answers2

0

I wonder if you can you try updating your Chrome driver again and copy it's direct path into your code. Also, check to see if you typed the path in correctly. Something similar to this happened to me before when I didn't have the updated Chrome driver in my code.

  • I just did that it is now throwing a different error which is -------------->"selenium.common.exceptions.WebDriverException: Message: unknown error: 'ms' must be a double" – Deadsshott Feb 27 '22 at 20:16
  • selenium.common.exceptions.WebDriverException: Message: unknown error: 'ms' must be a double (Session info: headless chrome=98.0.4758.102) (Driver info: chromedriver=2.37.544315 – Deadsshott Feb 27 '22 at 20:25
  • @Deadsshott Update the main question with this information/error message. – undetected Selenium Feb 27 '22 at 20:28
0

This error message...

selenium.common.exceptions.WebDriverException: Message: unknown error: 'ms' must be a double (Session info: headless chrome=98.0.4758.102) (Driver info: chromedriver=2.37.544315

...implies that the ChromeDriver was unable to initiate/spawn a new Browsing Context i.e. session.

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chrome=98.0
  • Release Notes of ChromeDriver v98.0 clearly mentions the following :

Supports Chrome version 98

  • But you are using chromedriver=2.37 which is old and ancient.

So there is a clear mismatch between chromedriver=91.0 and the chrome=96.0.4664.45


Solution

Ensure that:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352