vendredi 4 septembre 2020

having a problem with conditioning selenium

hi so im learning selenium and there is a problem (the "if" part) it doesnt wait for me to click left arrow (as an example) to do the task it just instantly runs it

enter code here

from selenium import webdriver
import chromedriver_binary  # Adds chromedriver binary to path
from selenium.webdriver import ActionChains
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("https://www.google.com/")
if Keys.ARROW_LEFT:
    element = driver.find_element_by_css_selector('.gLFyf')
    element.send_keys('khkh')
    element.send_keys(Keys.ENTER)

Aucun commentaire:

Enregistrer un commentaire