0
I am trying to fill out an online form automatically and the fields are in the same class, using Selenium and python I can fill in the first field with the campo01 = CHROMEDRIVER.find_element_by_class_name("jss14")
but as I do with others who have the same class jss14 ?
What separates one from the other is only the DIV they are in, the first input is in DIV jss70 and the second input in DIV jss80
HTML
"Primeiro Input"
<input aria-invalid="false" type="text" class="MuiInputBase-input MuiOutlinedInput-input jss14 MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense" value="">
"Segundo Input"
<input aria-invalid="false" type="text" class="MuiInputBase-input MuiOutlinedInput-input jss14 MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense" value="">
My Code
campo01 = CHROMEDRIVER.find_element_by_class_name("jss14")
campo01.send_keys(n_li)
campo01.send_keys(Keys.RETURN)
I have tried with each xpath but I get the error message : Selenium.common.exceptions.Nosuchelementexception: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="root"]/div/div/div/div/div[1]/div[2]/div[2]/div/div/input"}
Xpath I am using in the first input: //*[@id="root"]/div/div/div/div/div/div[1]/div[2]/div/div/input
Xpath I am using in the second input: //*[@id="root"]/div/div/div/div/div/div[1]/div[2]/div[3]/div/div/input