How can I press ENTER key with the execute_script in selenium python?

+2 votes

I'm not able to press ENTER key when executing the script. Below is my code:

(driver.execute_script("arguments[0].value = arguments[1]", f, "Hi!"))

The word "Hi!" is sent to the element. But, not able to press ENTER to send it. Also, send_keys() and submit() don't work in my code. This is the url where i'm working:

Mar 27, 2018 in Selenium by code_ninja
• 5,750 points

2 answers to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
+2 votes

The below code containing Keys.ENTER might just work for you:

from selenium.webdriver.common.keys import Keys
driver.find_element_by_css_selector("textarea._bilrf").send_keys("Hi!", Keys.ENTER)
answered Mar 27, 2018 by nsv999
• 5,030 points
Bro, cant thank you more. I was stuck with this Enter Key and you saved my life.
Haha. Your welcome :)
0 votes
import pyautogui

answered Mar 26 by anonymous

Related Questions In Selenium

0 votes
1 answer

How can I write test scripts in Selenium with python?

Hey Khushi, writing test scripts in Selenium ...READ MORE

answered May 9 in Selenium by Anvi
• 5,960 points
0 votes
1 answer

How can I delete an element in Selenium using Python?

Hi friend, getElementByClassName is not a method on ...READ MORE

answered Mar 26 in Selenium by Surya
• 820 points

edited Mar 27 by Omkar 66 views
0 votes
1 answer

How can I add Cucumber Jar files in Eclipse to use with Selenium Webdriver?

Hey Eshan, follow these steps to add ...READ MORE

answered 3 days ago in Selenium by Abha
• 6,370 points
0 votes
1 answer

How can I download the *.jar file from http:// using selenium WebDriver?

For Selenium Standalone Server use this: profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/java-archive"); and ...READ MORE

answered Apr 9, 2018 in Selenium by Martin
• 4,210 points
0 votes
1 answer

Selenium XPath error:- Element not found

The reason for Element not found exception ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,030 points
0 votes
1 answer

Need to download a file using Selenium

Pretty simple...Find the element or link using ...READ MORE

answered Mar 29, 2018 in Selenium by nsv999
• 5,030 points
0 votes
1 answer

How do i change the location where my file gets downloaded in Selenium Webdriver and firefox driver?

There are a couple of errors there. ...READ MORE

answered Apr 12, 2018 in Selenium by nsv999
• 5,030 points
0 votes
3 answers

How to specify "ENTER" button functionality in Selenium WebDriver code?

using OpenQA.Selenium.Interactions; Actions builder = new Actions(driver); ...READ MORE

answered Feb 12 in Selenium by anonymous

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.