Can Sikuli be used for web testing?

安稳与你 提交于 2019-12-11 03:47:21

问题


I was working with Sikuli for desktop application like notepad, but want to know like can I open new tab in browser using Sikuli?


回答1:


Yes, using Sikuli you can also automate browser. Take images of required web elements (Open new tab button in your case) and stimulate click action using Sikuli APIs.




回答2:


Yes, you can use Sikuli for web testing.

In this code example, you can use sikuli app to: open browser --> New tab --> Give a like on a webpage (UTAD in this case):

click("mozilla_icon.png")

click("nova_aba.png")

click("endereco.png")

paste("www.utad.pt")

type(Key.ENTER)

wait(8)

click("like_btt.png")

wait(5)

Images of sikuli code:




回答3:


yes you can use sikuli for performing open tab first take the image of new tab control like in case of FF https://drive.google.com/file/d/0B09BIsDTY_AuZFpMWko1U3BFc0E/view?usp=sharing .Save this image on you local machine. But make sure that image which is used for reference is visible on screen.Call the function mentioned below by and give it Absolute path to above mentioned image.

//provide absolute path in img 
public void click_Image(String img)
{
     s = new DesktopScreenRegion();
    target = new ImageTarget(new File(img));
     r = s.find(target);

    // Create a mouse object
     mouse = new DesktopMouse();
    // Use the mouse object to click on the center of the target region
    mouse.click(r.getCenter()); 

}


来源:https://stackoverflow.com/questions/30233637/can-sikuli-be-used-for-web-testing

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