'Robotframework - can't find chrome binary

I am trying to run Robotframework with Selenium in AWS Lambda. I have gotten both to work separately, but I can't seem to run SeleniumLibrary within Robotframework. I am referencing the same file path for chrome and chromedriver in the python code and the robotframework code. Python Code:

from selenium import webdriver
import os
import sys
import robot

def handler(event=None, context=None):
    options = webdriver.ChromeOptions()
    options.binary_location = '/opt/chrome/88.0.4324.150/chrome'
    options.add_argument('--headless')
    options.add_argument('--no-sandbox')
    options.add_argument("--disable-gpu")
    options.add_argument("--window-size=1280x1696")
    
    options.add_argument("--single-process")
    options.add_argument("--disable-dev-shm-usage")
    options.add_argument("--disable-dev-tools")
    options.add_argument("--no-zygote")
    options.add_argument(f"--user-data-dir={mkdtemp()}")
    options.add_argument(f"--data-path={mkdtemp()}")
    options.add_argument(f"--disk-cache-dir={mkdtemp()}")
    options.add_argument("--remote-debugging-port=9222")
    chrome = webdriver.Chrome("/opt/chromedriver/88.0.4324.96/chromedriver",
                               options=options)
    chrome.get("https://cnn.com/")
    return "Test Finished"

Robotframework Code:

Library    SeleniumLibrary

*** Keywords ***
Remote Browser
    ${prefs}       Create Dictionary
    ${chrome_options} =     Evaluate    sys.modules['selenium.webdriver'].ChromeOptions()    sys, selenium.webdriver
    Call Method    ${chrome_options}   add_argument    headless
    Call Method    ${chrome_options}   add_argument    disable-gpu
    Call Method    ${chrome_options}    add_experimental_option    prefs    ${prefs}
    ${chrome_options.binary_location}    Set Variable    /opt/chrome/88.0.4324.150/chrome
    ${options}=     Call Method     ${chrome_options}    to_capabilities      

    Create Webdriver    Chrome  executable_path=/opt/chromedriver/88.0.4324.96/chromedriver   desired_capabilities=${options}

    Go to     http://cnn.com
    Log    "Testing 123"  console=True

*** Test Cases ***
Valid Login
    Remote Browser
    [Teardown]  Close Browser

I get from Robotframework:

Valid Login                                                           | FAIL |
WebDriverException: Message: unknown error: cannot find Chrome binary
Stacktrace:
#0 0x559c4dfa9199 <unknown>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source