I don't find the element in specific website (https://insurconnect.b3.com.br/menu-web/ctp/TelaPrincipalCetip21)
I tested in other website and it worked.
tried By : Class,Xpath,FullXpath,Css Selector. Can't find the name or Id using the inspector.
I tried to make it wait with time.sleep
I really don't know what to do. My code is here:
import pandas as pd
from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
nav=webdriver.Edge(executable_path='C:/Users/F00010764/msedgedriver.exe') #o webdrive e o parâmetro mostrando o caminho
#Dados de acesso B3
website_b3 ="https://digital.icatuseguros.com.br/seguro-de-vida?utm_term=icatu%20seguros&utm_campaign=%5BRACC%5D%5BS%5D+Institucional&utm_source=adwords&utm_medium=ppc&hsa_acc=7589317064&hsa_cam=11999175291&hsa_grp=115633742533&hsa_ad=579263938725&hsa_src=g&hsa_tgt=kwd-1564194867&hsa_kw=icatu%20seguros&hsa_mt=b&hsa_net=adwords&hsa_ver=3&gclid=Cj0KCQiA-oqdBhDfARIsAO0TrGEnsUte5EboJEUqACTG82Xp6KFQW9QnNPV5msSmtHjNlq57oOzmFnMaAh9qEALw_wcB" #Link do site b3
nav.get(website_b3) #entrando no website, nesse em especifico no site da B3
time.sleep(7)
participante_path = nav.find_element_by_xpath("/html/body/form/table/tbody/tr/td/div[2]/table/tbody/tr[2]/td[3]/input")
Someone help me?
The elements you trying to access are inside an iframe, so you need to switch to that iframe in order to access these elements.
The following code works:
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
options = Options()
options.add_argument("start-maximized")
webdriver_service = Service('C:\webdrivers\chromedriver.exe')
driver = webdriver.Chrome(service=webdriver_service, options=options)
wait = WebDriverWait(driver, 20)
actions = ActionChains(driver)
url = "https://insurconnect.b3.com.br/menu-web/ctp/TelaPrincipalCetip21"
driver.get(url)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.CSS_SELECTOR,"iframe#main")))
wait.until(EC.element_to_be_clickable((By.ID, "e1"))).send_keys("my_first_input")
wait.until(EC.element_to_be_clickable((By.ID, "e2"))).send_keys("my_second_input")
wait.until(EC.element_to_be_clickable((By.ID, "e3"))).send_keys("my_third_input")
wait.until(EC.element_to_be_clickable((By.ID, "Entrada"))).click()
The result before clicking the submit button is: