I am doing a web automation with Python, but there is a problem that, although I tried all the solutions, I want to print data to the two inputs in the picture below, but none of the methods worked. I would be very happy if you could help me with this subject.
import os
import random
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.common.exceptions import TimeoutException
from selenium.common.exceptions import NoSuchElementException
from PIL import Image
from time import sleep
element = WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.CSS_SELECTOR, "//*[matches(@class, '_nghost-awn-ACCOUNT_ONBOARDING-15')]")))
element.send_keys("test input")
xpath_alternatives = [
'//*[contains(@class, "input-container") and contains(@class, "floated-label")]',
'//for[contains(text(), "Enter your business name") and contains(text(), "(optional)")]'
]
for xpath in xpath_alternatives:
print(xpath)
I tried many XPATH, I tried WebDriverWait, I tried EC, I tried CSS_SELECTOR but it didn’t work.
New contributor
jagrenti is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
8