Click() problem in an input with Selenium

Asked

Viewed 215 times

0

I’m developing an automation that makes a Choose file in an input, but when I click on the element:

driver.FindFirstElement(By.Id("chooseFile")).Click();

and every time the error returns to me:

"Referência de objeto não definida para uma instância de um objeto."
  • 1

    add the snippet of your HTML code

1 answer

1

Hello, In this case if you click the button it will open the file window, for you to choose which file you want to upload, in this way this wrong. Try to do it this way;

       driver.FindFirstElement(By.Id("chooseFile")).SendKeys("c://local do arquivo/arquivo.txt");

Instead click you insert the location where your file is stored.

see you later!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.