Do AutoIt scripts work with Selenium and Chrome Headless

匿名 (未验证) 提交于 2019-12-03 01:47:02

问题:

So, all my current scripts run with Selenium in Chrome Headless mode. Now, we have a small component which basically makes it mandatory for a user to upload a file before the flow gets completed.

The upload is a normal window file select box.

I had two solutions in mind to automate this - Sikuli or AutoIT. I'm very sure that Sikuli does not work in headless. What about AutoIT? Does it support headless mode?`

I am desperate to keep the scripts working headlessly since they are also linked to a Linux Jenkins machine and there is no way I can change that setup.

I did some browsing but there is no concrete answer available to suggest whether or not AutoIt runs in Chrome Headless. Any previous experience or tips is much appreciated!

回答1:

AutoIt can only work on the open, unlocked Windows Desktop - just like Sikuli or SeeShell Desktop Automation.

But have you checked out this answer: How to upload file using Selenium WebDriver in Java



回答2:

AutoIt can't be used to click on a headless browser. However, if the form is a standard file upload, you should be able to sendKeys() in selenium to send the path of the file to the input.

driver.findElement(By.cssSelector("input[type='file']")).sendKeys("/Users/me/Desktop/file.txt"); 


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!