So I tried to find this input by many ways and it simple can't be found
<div class="col-sm-8 col-lg-10 fb-field-container " style="min-height:26px">
<div class="fb-inline-field-container form-line" style="display: inherit;vertical-align:top;">
<input class="form-control tfield" widget="tentry" type="text" required="" aria-required="true" name="nome" value="" id="tentry_1800501884">
::after
</div>
</div>
Here some of what I tried:
By class: "col-sm-8 col-lg-10 fb-field-container"
By class: "fb-inline-field-container form-line"
By class: "form-control tfield"
By ID: "tentry_1381418948"
By css selector: "Input[class*='form-control tfield'" and with the 2 other classes
By xpath: "'//div[contains(@class, "form-control tfield")]'" and with the 2 other classes
Most of the errors i got are: 'str' object is not callable
Does anyone have an idea what i can do?
Here is my code:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.common.keys import Keys
from pytube import YouTube
from pytube import Channel
import time
import pyautogui
def subir_videos(login, senha):
options = Options()
options.add_argument("start-maximized")
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
driver.get('http://simplesprefeitura.pompeu.mg.gov.br/index.php?class=WelcomeView')
time.sleep(1)
botao_login = driver.find_element(By.XPATH, ("//span[.='Login']"))
botao_login.click()
time.sleep(1)
botao_login_2 = driver.find_elements(By.XPATH, ("//span[.='Login']"))
botao_login_2[1].click()
time.sleep(1)
campo_usuario = driver.find_element(By.XPATH, ('//div[contains(@class, "fb-inline-field-container form-line")]'))
# campo_usuario = driver.find_element(By.XPATH, ('//div[contains(@class, "col-sm-12 display-flex fb-field-container")]'))
campo_usuario.click()
time.sleep(1)
pyautogui.write(login)
time.sleep(1)
pyautogui.hotkey('tab')
time.sleep(1)
pyautogui.write(senha)
time.sleep(1)
pyautogui.hotkey('enter')
time.sleep(3)
botao_pesquisar = driver.find_element(By.CLASS_NAME, "js-search")
botao_pesquisar.click()
time.sleep(1)
pyautogui.write('videostvlist')
time.sleep(1)
pyautogui.hotkey('enter')
time.sleep(1)
botao_novo = driver.find_element(By.XPATH, "//*[contains(text(), 'Novo')]")
botao_novo.click()
time.sleep(1)
And here is where im getting trouble
campo_nome = driver.find_element(By.CSS_SELECTOR("Input[class*='fb-inline-field-container form-line'"))
campo_nome.click()
time.sleep(1)
UPDATE: i found that if i hit tab 37 times i get there so i'm using it like this while it works