Home > database >  how can i send ENTER/RETURN key with javascript executor code in selenium python?
how can i send ENTER/RETURN key with javascript executor code in selenium python?

Time:10-09

Hi all i am new to python selenium, i am in the process of automating a website but unfortunately the search text box of the website does not have any buttons to click once you enter the text

things i tried

1)driver.sendkeys-not working

2)JavaScript executor - just sends the data but no clue how to send the Enter/return key

 driver.execute_script("document.getElementsByClassName('tau-search__input')[0].value ='"   var "'");

3}Action chains class- tried to send keys but yet no result

also the search icon highlighted here is unable to send data and we can only send data by entering values and clicking on enter at the end enter image description here

there are no frames there too please help

CodePudding user response:

Try this:

input_element = driver.find_elements_by_class_name("tau-search__input")[0]
input_element.send_keys("your_text_string_input"   Keys.ENTER)

CodePudding user response:

I hope your xpath is wrong, you are pointing to the search icon not the search box. please share us the element screenshot if possible. your url is not working for us.

  • Related