Jacobvu84 / serenity-pageobject-junit-webdriver

4 stars 1 forks source link

Finding Web Elements #53

Open Jacobvu84 opened 5 years ago

Jacobvu84 commented 5 years ago

Đây là bài tập bổ trợ cho những học sinh mới. Nội dung của những bài tập này nhắm luyện tập khả năng dùng các locator strategy

Exercise 1 - Locate an element by id Exercise 2 - Locate an element by name Exercise 3 - Locate an element by tag Exercise 4 - Locate an element by link text Exercise 5 - Locate an element by css Exercise 6 - Enter values into a text field Exercise 7 - Checkboxes Exercise 8 - Radio buttons

Jacobvu84 commented 5 years ago

Exercise 1 - Locate an element by id

Dựa trên trang web này https://www.phptravels.net/ tìm tối thiểu 10 đối tượng theo id

Yêu cầu:

Mong đợi bài code bài tập được giao sẽ như sau

    public static WebElement MESSAGE_NEWSLETTER;

    @Test
    public void find_newsletter_element_by_id() {

        MESSAGE_NEWSLETTER = driver.findElement(By.id("exampleInputEmail1"));

       // TODO: will do late
    }
Jacobvu84 commented 5 years ago

Cách thức tiến hành tìm kiếm và kiểm tra dựa trên trình duyệt Chrome

Kết quả mong muốn sẽ nhìn thấy image

Kết qủa mong đợi sẽ nhìn thấy image

Để tránh nhầm lẫn vào sai xót trong quá trình điền loctor vào code. Nên copy từ Developer Tools.

P/S: Làm ơn check thật kỹ. Thầy mệt mỏi với việc ngồi dò tìm và check chính tả lắm rồi.
Jacobvu84 commented 5 years ago

Quiz:

1. The findElement method is used to locate a specific element on a web page.

Phương thức The findElement được dùng để định vị một đối tượng cụ thể trên trang web ?

3. What is a WebElement?

Tham khảo: