Open Jacobvu84 opened 5 years ago
Dựa trên trang web này https://www.phptravels.net/ tìm tối thiểu 10 đối tượng theo id
org.selenium.element.by.id
WhenLocatingElementsByXXX
ví dụ WhenLocatingElementsById
public static WebElement MESSAGE_NEWSLETTER;
@Test
public void find_newsletter_element_by_id() {
MESSAGE_NEWSLETTER = driver.findElement(By.id("exampleInputEmail1"));
// TODO: will do late
}
Kết quả mong muốn sẽ nhìn thấy
Kết qủa mong đợi sẽ nhìn thấy
Gõ id của đối tượng cần tìm kiếm. ví dụ partial-new-comment-form-actions
Bạn sẽ thấy số lượng đối tượng được tìm thấy bên tay trái và đối tượng được tìm thấy sẽ hight mầu vàng
Khi di chuyển chuột ( mouse over) lên vùng sáng màu vàng thì trên giao diện web sẽ higthlight đối tượng cần tìm
Để 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.
Phương thức The findElement
được dùng để định vị một đối tượng cụ thể trên trang web ?
By
objects are __Đối tượng By
là gì .......
click
) that interact with elements on a web page?
Đâ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