Well , to give the enter first Voce must import from selenium.webdriver.common.keys import Keys
this package performs pressing of all special keys including Enter
after you have done this, and only send the enter key to an item on the page:
Example of a script that searches google by clicking enter instead of the search button:
from selenium.webdriver.common.keys import Keys from selenium import webdriver
driver = webdriver.Chrome() driver.get('https://www.google.com/')
driver.find_element_by_xpath('/html/body/div/div[2]/form/div[2]/div[1]/div[1]/div/div[2]/input').send_keys("Enter pressionado")
# aqui eu pressiono e botao Enter
driver.find_element_by_xpath('/html/body/div/div[2]/form/div[2]/div[1]/div[1]/div/div[2]/input').send_keys(Keys.ENTER)
I hope I’ve solved your doubtful hugs
If you are trying to comment on the photos try the following:
driver.find_element_by_xpath("//button[@type='submit']").click()
and see if it works– edufgimenez