0

I'm trying to fill this form to improve my job, i tried with Selenium but something goes wrong:

driver= webdriver.Chrome('/Users/48604/Desktop/kyk/chromedriver')
driver.get('https://quintadb.com/widgets/cCsqTdWRnaWPBdGb4zgCkg/c_mw7dRmneW4mgWQzrFdOq')
fill = driver.find_element_by_xpath("//input[@name='dtype[cTqIlcPGbjsk_cIuZdPSoQ]' and @id='dtype_cTqIlcPGbjsk_cIuZdPSoQ']").click()
fill.send_keys('test')

but i am getting error:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@name='dtype[cTqIlcPGbjsk_cIuZdPSoQ]' and @id='dtype_cTqIlcPGbjsk_cIuZdPSoQ']"}

I tried as well:

 fill = driver.find_element_by_xpath("//input[@name='dtype[cTqIlcPGbjsk_cIuZdPSoQ]' and @id='dtype_cTqIlcPGbjsk_cIuZdPSoQ']").click()[0]

but still not working, any idea?

0

1 Answer 1

1

Bring .click() to the next line:

fill = driver.find_element_by_xpath("//input[@name='dtype[cTqIlcPGbjsk_cIuZdPSoQ]' and @id='dtype_cTqIlcPGbjsk_cIuZdPSoQ']")
fill.click()
fill.send_keys('test')

Output:

enter image description here

Your code didn't work because you have assigned the output of the .click() function to the variable fill. When you print out the type of fill in your code, this is what it prints:

fill = driver.find_element_by_xpath("//input[@name='dtype[cTqIlcPGbjsk_cIuZdPSoQ]' and @id='dtype_cTqIlcPGbjsk_cIuZdPSoQ']").click()
print(type(fill))

Output:

<class 'NoneType'>

And a variable of type NoneType does not have a function called .send_keys(). Hence, your code didn't work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.