I wrote an application in java using selenium and chromedriver which log-in to a website and then performs operations. The application was developed on a windows server 2012 and I'm connecting to the server via RDP from my local machine. When I'm logged on server, everything runs correctly (keeping the rdp connection active).
The application is then started via a scheduled task in the windows task scheduler at regular intervals. The application is deployed on a payara server.
The problem arises when I close the RDP session. The application is launched but in the payara console I notice that all the elements of the web page are not found, as if it were necessary to have the chrome window active. I tried to use the headless mode (taking screenshots gradually) but for some reason I remain still at login (as if the headless mode was received by the target site), thus failing to login and the consequent execution of the operations.
Looking on the stacko. Forum, I found this thread that could probably solve the problem but it is not clear to me what the indicated script does. LINK
The question I can't answer is: in order to correctly launch the application from the windows task scheduler without using the headless mode, is the RDP connection always active? Or is it possible to start the software even though RDP is disconnected?
Some technical details:
Chrome Driver setup:
System.setProperty("webdriver.chrome.driver", "C:\\chromedriver_win32\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
options.setExperimentalOption("useAutomationExtension", false);
options.addArguments("--disable-blink-features");
options.addArguments("--disable-blink-features=AutomationControlled");
options.addArguments("--no-sandbox");
options.addArguments("--disable-gpu");
options.setAcceptInsecureCerts(true);
options.addArguments("--start-maximized");
driver = new ChromeDriver(options);
Any suggestions are welcome. Thanks a lot in advance
I am not sure it will help you or not.. You can enable RDP keep alive using registry
Here you may get some idea https://admx.help/?Category=Windows_10_2016&Policy=Microsoft.Policies.TerminalServer::TS_KEEP_ALIVE https://superuser.com/questions/1144853/how-do-i-keep-an-rdp-session-alive-from-the-client-side
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.