- Follow the Page Object Model pattern strictly
- Separate locators and actions in page object files
- Maintain directory structure that mirrors business logic
- Page objects should be independent from one another when possible
- Reuse existing page objects and utilities before creating new ones
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test } from '@playwright/test'; | |
test("Register", async ({ page }) => { | |
await page.goto('https://material.playwrightvn.com/'); | |
await page.click('//a[@href="01-xpath-register-page.html"]'); | |
await page.locator('//input[@id="username"]').fill('Trangdt98'); | |
await page.locator('//input[@id="email"]').fill('[email protected]'); | |
await page.locator('//input[@id="female"]').check(); | |
await page.locator('//input[@id="traveling"]').check(); | |
await page.locator('//select[@id="country"]').selectOption({ value: "usa" }); | |
await page.locator('//input[@id="profile"]').setInputFiles("D:/pw-course (1)/Data/165522424_10225222190398060_7591752606277882188_n.jpg"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import time | |
from playwright.sync_api import sync_playwright | |
import requests | |
# Biến toàn cục để lưu cookie và lock để đảm bảo thread-safe | |
cookie_storage = None | |
cookie_lock = threading.Lock() | |
# Luồng 1: Login và lấy cookie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const listA = [1, 2, 3, 4]; | |
const listB = [4, 5, 6]; | |
// Build map | |
const mapA = { | |
'1': true, | |
'2': true, | |
'3': true | |
}; | |
listA.forEach(item => mapA[item] = true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/Users/alex/workspace/001-teaching-courses/004-udemy/001-ts | |
/Users/alex/.nvm/versions/node/v20.0.0/bin/node | |
/Library/Preferences/Logging/.plist-cache.GZngdQrO | |
/Users/alex/workspace/001-teaching-courses/004-udemy/001-ts/node_modules/fsevents/fsevents.node | |
->0xf5018b9f9838bf57 | |
->0xf432b7ce42f96861 | |
->0xa9b4f01ee205c115 | |
->0x73d3239d63d7d1ed | |
count=0, state=0 | |
->0x12fb13533d75bb25 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="container" id="ancestor"> | |
<h1 id="self">User Registration</h1> | |
<form id="registrationForm"> | |
<div class="form-group" id="parent"> | |
<label for="username" id="preceding">Username:</label> | |
<input type="text" id="username" name="username" required=""> | |
</div> | |
<div class="form-group" id="child"> | |
<label for="email">Email:</label> | |
<input type="email" id="email" name="email" required=""> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form id="registrationForm"> | |
<div class="form-group" id="parent"> | |
<label for="username" id="preceding">Username:</label> | |
<input type="text" id="username" name="username" required=""> | |
</div> | |
<div class="form-group" id="child"> | |
<label for="email">Email:</label> | |
<input type="email" id="email" name="email" required=""> | |
</div> | |
<div class="form-group"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sử dụng hình ảnh Maven chính thức làm hình ảnh cha | |
FROM maven:3.8.1-openjdk-11-slim | |
# Đặt thư mục làm việc trong container | |
WORKDIR /app | |
# Sao chép nội dung thư mục hiện tại vào container tại /app | |
COPY . /app | |
# Cài đặt cron |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function locNguyenTo(arr) { | |
const arrNguyenTo = []; | |
for (let i = 0;i < arr.length; i++) { | |
if (arr[i] === 0 || arr[i] === 1) { | |
continue; | |
} | |
let count = 0; | |
for (let j=2; j < arr[i]; j++) { |
NewerOlder