Appium Workshop - Sử dụng AI/ML để tìm đối tượng

Nơi thông tin về các vấn đề liên quan đến khóa học Appium - Mobile Automated Test.
Forum rules
Nơi thông tin về các vấn đề liên quan đến khóa học Appium - Mobile Automated Test.
Post Reply
cuhavp
Jr. Tester
Posts: 61
Joined: Mon 21 Jan, 2013 3:52 pm
Contact:

Appium Workshop - Sử dụng AI/ML để tìm đối tượng

Post by cuhavp »

Tham khảo 3 chủ đề trước trong Appium workshop :
Tiếp theo là sử dụng AI/ML để tìm đối tượng.
Đây là một trong những xu hương của những năm tiếp theo. Trí tuệ nhân taoh và máy học đang là một trong nhưng xu hướng tất yếu của nghành công nghệ thông tin hiện nay. Kiểm thử tự động cũng không đứng ngoài xu hướng này. Các công ty dich vụ về kiểm thử đang bỏ rất nhiều nhân lực để tìm hiểu cũng như ứng dụng vào trong công việc của chính họ.
Cộng đồng Appium cũng tìm cách đưa tính năng này vào trong bản release mới nhất này/

Để làm được việc này Appium hỗ trợ tính năng plugin : test-ai-classifier

Code: Select all

npm install test-ai-classifier 
Và phiên bản appium thấp nhất là 1.9.2-beta.2.

Và dưới đây là ví dụ:

Code: Select all


    private By search = MobileBy.custom("search");
    private By cancel = MobileBy.AccessibilityId("Cancel");


    @BeforeTest
    public void setUp() throws IOException {
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability("platformName", "iOS");
        caps.setCapability("platformVersion", "11.4");
        caps.setCapability("deviceName", "iPhone 6");
        caps.setCapability("bundleId", BUNDLE_ID);

        HashMap<String, String> customFindModules = new HashMap<>();
        customFindModules.put("ai", "test-ai-classifier");

        caps.setCapability("customFindModules", customFindModules);
        caps.setCapability("shouldUseCompactResponses", false);

        driver = new IOSDriver<MobileElement>(new URL("http://localhost:4723/wd/hub"), caps);
        wait = new WebDriverWait(driver, 10);
    }

    @AfterTest
    public void tearDown() {
        try {
            driver.quit();
        } catch (Exception ign) {
        }
    }

    @Test
    public void testFindElementUsingAI() throws InterruptedException {
        // find and click on the search button using the classifier
        driver.findElement(search).click();
        Thread.sleep(10000);
        // prove that the click was successful by locating the 'cancel' button
        wait.until(ExpectedConditions.presenceOfElementLocated(cancel));
    }
}




Post Reply

Return to “Dạy Appium - Mobile Automated Test”