mardi 27 juillet 2021

How to paste text in a DIV text area using SELENIUM and Python

I am trying to send some text to the text box. The problem is that when the text is short(small) it works, but when the text is long(big) it doesn't work. Please, I have pasted my code below. Let me know what I am doing wrong

from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()
driver.get("https://editor.swagger.io/")


# when we read swagger file from excel will put it here

swagger = '{"swagger":"2.0","info":{"title":"test api *************************************}'

#fetch the box for the swagger input
editor = driver.find_element_by_class_name("ace_text-input")
#
# #clear it
editor.clear()
# #send the swagger we want to convert
editor.send_keys(swagger)```



Aucun commentaire:

Enregistrer un commentaire