0

I wanna create a bot by using Python Selenium, which be able to paste value I gave for it. Headings and to select item - clear to me, but I don't know, how to paste text in description. For example:

enter image description here

So how I can paste text? I can't paste text in textarea and body element(XPath similar to main html and body)

description = browser.find_element(By.ID, 'product-description')
description.send_keys('fddfdfdfdf')
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
kantemyr
  • 1
  • 1

1 Answers1

0

As per the snapshot provided:

frame

the desired element is clearly with an an <iframe>.


Solution

To send a character sequence within the desired element you have to:

  • Induce WebDriverWait for the desired frame to be available and switch to it.

  • Induce WebDriverWait for the desired element to be clickable.

  • You can use either of the following locator strategies:

    WebDriverWait(driver, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe_css_selector")))
    WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "product-description"))).send_keys("fddfdfdfdf")
    
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Still not working :( It doesn't even give an obvious error: Message: Stacktrace: Backtrace: – kantemyr Mar 04 '23 at 09:00
  • @kantemyr Did you replace `iframe_css_selector` with the actual real time value? – undetected Selenium Mar 04 '23 at 09:02
  • Yes, I did this: WebDriverWait(browser, 20).until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR, "#product-description_ifr"))) WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.ID, "product-description"))).send_keys("fddfdfdfdf") – kantemyr Mar 04 '23 at 09:31