Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting NameError: name 'ActionChains' is not defined?

Tags:

python

Im pretty new to python and trying to fill out a web form automated.

Im getting this Error:

Traceback (most recent call last): File "main.py", line 24, in ActionChains(browser)\ NameError: name 'ActionChains' is not defined

And this is my code:

from time import sleep
from selenium import webdriver

browser = webdriver.Chrome ('/Users/max/Downloads/chromedriver')

browser.get ('http://www.brix.de/computer/web_html_php_et_al/formular-test_smm_01.html')

inputs = browser.find_element_by_xpath(
    '/html/body/form[1]/table')

ActionChains(browser)\
.move_to_element(input[vorname]).click()\
.send_keys('name')\
.move_to_element(input[name]).click()\
.send_keys('Surname')\
.perform()

Can somebody help me please?

like image 634
Max F Avatar asked Oct 23 '25 18:10

Max F


1 Answers

I think you are missing the import, try the following:

from time import sleep
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains

browser = webdriver.Chrome ('/Users/kiran/Downloads/chromedriver')

browser.get ('http://www.brix.de/computer/web_html_php_et_al/formular-test_smm_01.html')

inputs = browser.find_element_by_xpath(
    '/html/body/form[1]/table')

ActionChains(browser)\
.move_to_element(input[name]).click()\
.send_keys('name')\
.move_to_element(input[vorname]).click()\
.send_keys('Surname')\
.perform()
like image 103
Isma Avatar answered Oct 26 '25 07:10

Isma



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!