Hello i am trying to create program that can fill in google forms automatically i have this error can you guys help me

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
import time

def fill_google_form(form_url, chrome_profile_path):
    # Initialize Chrome WebDriver with ChromeDriverManager
    driver = webdriver.Chrome(ChromeDriverManager().install())
    
    # Set Chrome options
    options = webdriver.ChromeOptions()
    options.add_argument("user-data-dir=" + chrome_profile_path)

    # Open the form URL
    driver.get(form_url)
    
    # Wait for the page to load
    time.sleep(2)
    
    # Find and fill the name field
    name_field = driver.find_element_by_xpath("//input[@aria-label='Name']")
    name_field.send_keys("asd")
    
    # Find and fill the price field
    price_field = driver.find_element_by_xpath("//input[@aria-label='Price']")
    price_field.send_keys("123")
    
    # Submit the form
    submit_button = driver.find_element_by_xpath("//span[text()='Submit']")
    submit_button.click()
    
    # Close the WebDriver
    driver.quit()

# Example Google Form URL
form_url = "YOUR_FORM_URL_HERE"

# Path to the Chrome profile directory
chrome_profile_path = "C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\User Data\\Profile 3"

# Fill the Google Form using the specified Chrome profile
fill_google_form(form_url, chrome_profile_path)
ERROR
xception has occurred: AttributeError
'str' object has no attribute 'capabilities'
AttributeError: 'str' object has no attribute 'capabilities'

During handling of the above exception, another exception occurred:

  File "C:\Users\user\Desktop\pathway\vask.py", line 7, in fill_google_form
    driver = webdriver.Chrome(ChromeDriverManager().install())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\user\Desktop\pathway\vask.py", line 41, in <module>
    fill_google_form(form_url, chrome_profile_path)
AttributeError: 'str' object has no attribute 'capabilities'

Hello @Aleksandre1999 ,
It’s hard to help you like this please define your problem!
Put the links!

I want to automate filling in a Google Form. Do you know how to do it? The form includes name and number fields.

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like

I appreciate your help can you suggest to me any Google extension that can fill google form as i want it