Jacobvu84 / selenium-vietnam-training-course

Questions Tracking
7 stars 5 forks source link

Chụp ảnh giao diện màn hình web với selenium để so sánh đã đúng với thiết kế qua từng bản build #35

Closed NTHang closed 6 years ago

NTHang commented 6 years ago

Hi all Em muốn hỏi làm sao để chụp màn hình và so sánh hình ảnh web qua từng bản build vẫn đúng với thiết kế ạ. Làm thế nào để biết các vị trí text, ảnh đã hiển thị đúng vị trí căn chỉnh đúng tỉ lệ. Em cảm ơn ạ.

Jacobvu84 commented 6 years ago

Để chụp màn hình thì dùng hàm TakesScreenshot. Có thể chụp toàn bộ màn hình hay chụp từng vùng trên màn hình.

Còn để so sánh hai hình ảnh. Em phải chụp được cái hình chuẩn. Sau đó mỗi lần chạy thì lại chụp lại hình ở vị trí đó rồi so sánh với hình chuẩn.

Việc so sánh em nên tham khảo class có tên là Image của java.awt.Image

NTHang commented 6 years ago

Cho e hỏi thêm chạy trên firefox 53 chạy xong là có cứ báo firefox stop. Em nên chạy ở bản firefox bao nhiêu ạ.

Jacobvu84 commented 6 years ago

theo anh thì cứ mới nhất mà chạy em. bản 56 có rồi đó. Chú ý tính tương thích của selenium webdriver và gecko driver

NTHang commented 6 years ago

Em có chạy dữ liệu test từ file excel. Em đã lấy đúng name của ô textbox rồi mà nó cứ báo lỗi: Element not found. Em không hiểu vì sao ạ

Jacobvu84 commented 6 years ago

Do sai locator hoặc do timeout

On Oct 22, 2017 20:54, "NTHang" notifications@github.com wrote:

Em có chạy dữ liệu test từ file excel. Em đã lấy đúng name của ô textbox rồi mà nó cứ báo lỗi: Element not found. Em không hiểu vì sao ạ

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vuthelinh/selenium-vietnam-training-course/issues/35#issuecomment-338479279, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8DgNOag_du6qSV3tzdj7cMJybHd0wvks5su0kLgaJpZM4QBjVU .

NTHang commented 6 years ago

Em đang dùng firefox 53 và geckodriver 0.18.0 thì có tương thích không ạ. Nhiều lúc e chạy thấy ok nhưng mà có lúc chạy xong cứ báo firefox stop

2017-10-22 20:55 GMT+07:00 Jacob Vu notifications@github.com:

Do sai locator hoặc do timeout

On Oct 22, 2017 20:54, "NTHang" notifications@github.com wrote:

Em có chạy dữ liệu test từ file excel. Em đã lấy đúng name của ô textbox rồi mà nó cứ báo lỗi: Element not found. Em không hiểu vì sao ạ

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vuthelinh/selenium-vietnam-training- course/issues/35#issuecomment-338479279, or mute the thread https://github.com/notifications/unsubscribe-auth/AA8DgNOag_ du6qSV3tzdj7cMJybHd0wvks5su0kLgaJpZM4QBjVU .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/vuthelinh/selenium-vietnam-training-course/issues/35#issuecomment-338479340, or mute the thread https://github.com/notifications/unsubscribe-auth/AfXbNhAWeuEAqRvsG4DY6qyGkqksWIHmks5su0lGgaJpZM4QBjVU .

Jacobvu84 commented 6 years ago

geckodriver 0.18.0 compatible with Firefox 56 and greater.

Theo dõi những sự thay đổi của geckodriver tại đây:

https://github.com/mozilla/geckodriver/releases