0

Before I get blasted in my comments on this question, I am well aware that this is a possible duplication of this link, but the answer provided is not helping me out with my instance of code, even after applying an adjusted version of the answer in my code. I have looked into many answers, including installing Chromedriver into my device, but to no avail.

My code is as follows:

from selenium import webdriver
import time

options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
options.binary_location = "/usr/bin/chromium"
driver = webdriver.Chrome(executable_path = r'C:\Users\user\Downloads\chromedriver_win32')
driver.get('http://codepad.org')

text_area = driver.find_element_by_id('textarea')
text_area.send_keys("This text is send using Python code.")

Every time I run the code, including the executable_path = r'C:\Users\user\Downloads\chromedriver_win32' I keep getting a permission error message when I run the code with the executable path. My code without the path is the same minus the executable_path which I replace with driver = webdriver.Chrome(options), but I get the error message argument of type 'Options' is not iterable.

Any help with this problem is greatly appreciated. Admittedly I am a bit new to Python, and coding, in general, and I am trying new ideas to learn the program better, but everything that I try to find an answer to just breaks my code in general.

Michael Pate
  • 89
  • 1
  • 9

1 Answers1

1

Try adding the executable file name at the end of executable_path argument:

executable_path = r'C:\Users\user\Downloads\chromedriver_win32\chromedriver.exe'

Code I used for testing:

from selenium import webdriver
import time

options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
options.binary_location = "/usr/bin/chromium"
driver = webdriver.Chrome(executable_path = r'C:\Users\user\Downloads\chromedriver_win32\chromedriver.exe')
driver.get('http://codepad.org')

text_area = driver.find_element_by_id('textarea')
text_area.send_keys("This text is send using Python code.")
Thaer A
  • 2,243
  • 1
  • 10
  • 14
  • When I ran the code after adding the execuable_path argument to the options variable, I got a TypeError: __init__() got an unexpected keyword argument 'executable_path'. And the Executable Path argument was added to the driver variable as shown in my code above. – Michael Pate Apr 12 '20 at 02:50
  • @MichaelPate I added the code I used for testing to my answer. It works fine on my end. Did you make any changes to it? – Thaer A Apr 12 '20 at 02:59
  • 1
    I get a permission error message. It might just be my device, which is really annoying but I have a working code that just needs the proper permissions. So if the code works on your end, its just a problem with my device. – Michael Pate Apr 12 '20 at 05:00