Reputation: 135
I'm trying to enter in text input in this 'CC' field located at:
using python and selenium. It seems to be wrapped in a frame or two, and I'm unable to locate the element using selenium. Code is below. What am I doing wrong?
time.sleep(15)
driver.switch_to.frame('SCPIFRAMEMozilla') #('SCPFRAMEBUFFER')
captcha=driver.find_element_by_name('CC')```
Upvotes: 1
Views: 157
Reputation: 29362
You can try with the below code : I have included explicit Wait
:
driver.maximize_window()
wait = WebDriverWait(driver, 10)
driver.get("https://ggbs.tarim.gov.tr/cis/servlet/StartCISPage?PAGEURL=/FSIS/ggbs.takviyeGidaSorgu.html&POPUPTITLE=AnaMenu")
wait.until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "iframe.SCPIFRAMEMozilla")))
wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, "input.FIELDInputEdit"))).send_keys("Some value")
Imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
Upvotes: 1
Reputation: 66
you can try xpath instead of name ;
captcha = driver.find_element_by_xpath("xpath")
i looked on the site and xpath is ==> //*[@id='F_11']
so it will be like this
captcha = driver.find_element_by_xpath("//*[@id='F_11']")
Upvotes: 1