selenium-python-aws-lambda icon indicating copy to clipboard operation
selenium-python-aws-lambda copied to clipboard

Won't work after change.

Open david-vendel opened this issue 7 years ago • 5 comments

Hey there. I tried to make it work. If I just upload your ZIP to lambda and run the function, it works. So I decided to change a bit of code in lambda_function.py, and that's only to edit line 49, driver.get('http://www.geneva.info/') after this change, I pack it back to ZIP, upload and run test. I get this error:

START RequestId: f6bd2ac2-e78c-11e8-86d6-19ee2b8cd09b Version: $LATEST
Starting google.com
Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
: WebDriverException
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 46, in lambda_handler
    driver = webdriver.Chrome(chrome_options=chrome_options)
  File "/var/task/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
    self.service.start()
  File "/var/task/selenium/webdriver/common/service.py", line 88, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

I use Selenium on Windows, but I am fairly new to AWS. What is a problem here and how to make it work? Thank you.

david-vendel avatar Nov 13 '18 21:11 david-vendel

Hi @justdvl, Please change the chromedriver permission.

chmod 777 chromedriver

ManivannanMurugavel avatar Nov 14 '18 07:11 ManivannanMurugavel

Thanks. I am total noob here. How do I change that? cli?

david-vendel avatar Nov 14 '18 19:11 david-vendel

Hi @ManivannanMurugavel , can you please tell us how to fix this issue .

I am also getting the same error

gouravbns avatar Aug 27 '19 08:08 gouravbns

Hi @ManivannanMurugavel @justdvl @gouravbns , how could this problem be solved?

actioncorp3 avatar Feb 20 '20 13:02 actioncorp3

Hi, I had the same issue on Windows environment, but was able to resolve it by using Ubuntu instead. It appears Windows default zip application does not always correctly handle Linux file attributes.

Here's the steps I took to make it work. If you only have Windows environment, try using Windows Subsystem for Linux.

On Ubuntu,

# Install zip and unzip
sudo apt-get install zip unzip

# Download lambda_function.zip from this repository
wget https://github.com/ManivannanMurugavel/selenium-python-aws-lambda/raw/master/lambda_function.zip

# Create a folder to store the content of lambda_function.zip
mkdir lambda_function

# Unzip lambda_function.zip into the folder you just created
unzip lambda_function.zip -d lambda_function/

# Go into the folder
cd lambda_function

# Now, modify lambda_function.py however you want.

# Create a new zip file with your changes
zip -r {your_desired_destination_folder}/lambda_function.zip *

Then, upload the newly created lambda_function.zip to your AWS S3. Hope this helps!

cptrfan avatar Mar 15 '20 01:03 cptrfan