2gis / Winium.Desktop

Winium.Desktop is Selenium Remote WebDriver implementation for automated testing of Windows application based on WinFroms and WPF platforms.
Mozilla Public License 2.0
403 stars 140 forks source link

Winium not typing text in TextBox Properly - Windows 10 #259

Open bhaskaralluri opened 6 years ago

bhaskaralluri commented 6 years ago

Here i am attaching 3 Screen shots. Please look at the application in the screen shots you can easily understand the flow. I am giving my automation code below. ID's,Names are correct no issue in that. Problem comes on the window where i have text boxes ( First Name, Last Name etc), In case on that window if i click enter manually in the text box then winium typing correctly otherwise, i just see some mouse movement on the app and does some weird things like...complete erasing my java code and type text in that etc....Not sure about the issue, I am new to winium hence practicing to see if it works or not for us. By Googling on this topic i got to know that these is some display scaling issue on windows 10 machine, is this the reason ? I do not see any element not found exceptions on console.

WiniumDriver driver; WiniumDriverService service; DesktopOptions options;

@BeforeClass
public void Start() throws IOException{

    options = new DesktopOptions();
    options.setApplicationPath("C:\\Users\\T1890\\Downloads\\TicketSystem\\Demo.exe");
    File driverPath = new File("C:\\Users\\T1890\\Downloads\\Winium.Desktop.Driver\\Winium.Desktop.Driver.exe");
    service = new WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999).withVerbose(true).withSilent(false).buildDesktopService();
    service.start();
}

@Test
public void Processing() throws InterruptedException{
    driver = new WiniumDriver(service,options);
    Thread.sleep(1000);
    driver.findElement(By.name("Ticket")).click();
    //Thread.sleep(1000);
    driver.findElement(By.name("Create New")).click();
    Thread.sleep(5000);

    //driver.findElement(By.id("TextBox1")).click();
    driver.findElement(By.id("TextBox1")).sendKeys("dasdsad"); <--- This is not happening
    //Thread.sleep(2000);

    driver.findElement(By.id("TextBox2")).sendKeys("xxxxxxx");
    driver.findElement(By.id("RadioButton1")).click();
    //driver.findElement(By.id("1001")).click();
    driver.findElement(By.id("TextBox3")).sendKeys("Test");

    driver.findElement(By.id("btnSubmit")).click();
}
ctt-1 ctt-2 ctt-3
heilwood commented 6 years ago

display scale is 100%? image

are you finding element in your application window? element with TextBlock1 can be also in another applications. driver.findElement(By.id("yourApplicationMainWindowIdWhereAllElementsIsPresent"))findElement(By.id("TextBox1")).sendKeys("dasdsad");

venkatesh143293 commented 3 years ago

I am also facing the same issue. any solution?

ProfoundPenguin commented 1 year ago

Been 4 years, no solution (WONDERFUL)