How to Test Print-preview of Chrome browser using Chrome webdriver?

前端 未结 1 1857
陌清茗
陌清茗 2021-01-22 15:50

I have tried using switching between windows using

    String winHandleBefore = driver.getWindowHandle();
    
    for (String winHandle :          


        
相关标签:
1条回答
  • 2021-01-22 16:18

    I have found the answer to my question. I used below code snippet.

     //Create a Region for Desktop Screen
     ScreenRegion s = new DesktopScreenRegion();
     //Find target with below Image in Desktop Screen
     Target target = new ImageTarget(new File("Image.png"));
     ScreenRegion r = s.find(target);
     // Create a mouse object
     Mouse mouse = new DesktopMouse();
     // Use the mouse object to click on the center of the target region
     mouse.click(r.getCenter());
    

    With the help of this snippet you would able to find the print or cancel and do the mouse click event and proceed with selenium tests. This was possible using sikuli API

    0 讨论(0)
提交回复
热议问题