vendredi 27 mars 2015

Automate through a remote desktop using selenium and AutoIt



I want to automate certain tasks which needs it to go through remote desktop. I will share the code which i wrote till now.



public class MainClass
{
static WebDriverWait wait;
static WebDriver driver;
public static void main(String args[])
{
driver = new HtmlUnitDriver(true);
driver.get("https://mysite");
WebElement submit_element=driver.findElement(By.id("Log_On"));
driver.findElement(By.id("Enter user name")).sendKeys("my_username");
driver.findElement(By.name("passwd")).sendKeys("my_password");
submit_element.click();
driver.findElement(By.id( "folderLink_0")).click();
driver.findElement(By.id( "folderLink_2")).click();
driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
System.out.println(driver.getPageSource());
driver.findElement(By.id("idCitrix.M")).click();
System.out.println(driver.getPageSource());
}
}


The line of code driver.findElement(By.id("idCitrix.M")).click(); opens the remote desktop in a new window.


The line System.out.println(driver.getPageSource()); is retrieving the same code in both places.


I believe this cannot be done solely by selenium. By browsing through the internet i learnt it is possible to do this using AutoIt. Any guidance is appreciated.Thank you.




Aucun commentaire:

Enregistrer un commentaire