Sendkeys does not work on the machine that will run

Asked

Viewed 241 times

1

I am doing an automation that is necessary to give a Sendkeys but when I run it on the other machine that will run the automation it does not do the function.

            DirectoryInfo diretorio = new DirectoryInfo(Diretorio);
            com o parametro)
            FileInfo[] Arquivos = diretorio.GetFiles();
            string file = null;
            foreach (FileInfo arquivo in Arquivos)
            {
                file = arquivo.Name;
                Diretorio = string.Concat(@"C:\Users\Robo_RA\Desktop\Anexo\", ID, @"\",file);
                browser.FindFirstElement(By.XPath("input[class='form-control-file validacao']")).ClickJs();
                Thread.Sleep(1000);

               // ja tentei
                SendKeys.Send(Diretorio);
                SendKeys.Send("{ENTER}");
              // esse tambem
                System.Windows.Forms.SendKeys.SendWait(Diretorio);
                System.Windows.Forms.SendKeys.SendWait(@"{Enter}");
            }
  • Give details of the machine where it works and where it doesn’t work.

  • @Cypherpotato Where it works is a windows 10, running on VS, and where it doesn’t work is a windows 7 desktop... already updated the framework.

  • 2

    Usually this is prevention of Shatter Attack from Windows itself. Applications are running in high mode?

  • I disabled the UAC, working... vlw

1 answer

-1

Hello My Name and Giovane. so I understood the error is not in the logic but in the implementation I already used Selenium once usually it works to send the Sendkeys this and a gabiarra to my view because Sendkeys and sent by the form not by Selenium.

use this:

browser.FindFirstElement(By.XPath("input[class='form-control-file validacao']")).SendKeys(Diretorio);
browser.FindFirstElement(By.XPath("input[class='form-control-file validacao']")).Click();

I know the question is from 2019 but I think the answer may still be useful.

Browser other questions tagged

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