I've deployed a Flask backend API to Azure App Services, and in the backend I have a script that uses Selenium to scrape information to send back to the client. Looking at the answers from another post, I wanted to try the solution by Dodger in which I've included a Chrome binary, along with the Chromedriver, in the github repository that is being deployed. It works locally with windows-64 binaries, and because the App Services runs on a Linux operating system, I pushed the 64 bit Linux versions of the binaries instead to be deployed. This is the code I have in the backend to start the driver:
options = webdriver.ChromeOptions()
options.add_argument('--headless=new')
chrome_binary_relative_path = "binaries/chrome-linux64/chrome"
chrome_binary_path = os.path.join(os.path.dirname(__file__), chrome_binary_relative_path)
options.binary_location = chrome_binary_path
chromedriver_path = "drivers/linux64/chromedriver"
driver = webdriver.Chrome(service=Service(executable_path=chromedriver_path), options=options)
From the log stream, these are part of the following errors I get:
driver = webdriver.Chrome(service=Service(executable_path=chromedriver_path), options=options)
raise WebDriverException(f"Service {self._path} unexpectedly exited. Status code was: {return_code}")
selenium.common.exceptions.WebDriverException: Message: Service /root/.cache/selenium/chromedriver/linux64/114.0.5735.90/chromedriver unexpectedly exited. Status code was: 127
I wanted to know if this kind of solution was possible before attempting to build the code in a Docker container instead, since I have no experience working with that