Thứ Hai, 10 tháng 8, 2020

Selenium là công nghệ gì, và Lê Dương đang làm gì...

👆👆👆,

Chào các bạn trẻ, hôm nay, tôi xin giới thiệu Lê Dương, một đồng tác của bài viết này, và những bài viết khác trong tương lai. Lê Dương là ông anh thời học ở NUS. Anh ấy nghiên cứu về Vật lí học (Physics), và bây giờ anh ấy là Princial Machine Learning Researcher ở Cyberlogitec, một công ty Hàn Quốc có trụ sở ở Hà Nội. Anh ấy từng là một người làm thí nghiệm mô phỏng vật lý (kiểu như thí nghiệm của trung tâm CERN, Thuỵ Sỹ). Anh Dương đã từng viết code Fortran trong phòng thí nghiệm, và anh ấy bây giờ chuyển sang làm IT.

Figure 0: Anh Lê Dương (ngoài cùng bên phải) và những người cộng sự cùng lab tại thời làm R&D ở Liege, Bỉ.

Selenium

    Trong bài viết, chúng tôi giới thiệu Selenium, một công nghệ kiểm thử webapp tự động. Công nghệ này giúp bạn kiểm thử các web có hệ thống và tiến tới kiểm thử tự động. Selium là một tập hợp của những công cụ (tool) và thư viện (libary) để hỗ trợ sự tự động hoá của trình duyệt web (web browsers). Sự tự động hoá ở đây được hiểu là sự giả lập trình duyệt, gửi câu lệnh đến trình duyệt web, từ đó mình có thể tự động hoá những phép kiểm thử (test cases) của webapp. Sau đây là một quote từ những nhà phát triển công nghệ Selenium 👀.

"It provides extensions to emulate user interaction with browsers, a distribution server for scaling browser allocation, and the infrastructure for implementations of the W3C WebDriver specification that lets you write interchangeable code for all major web browsers."

Cốt lỗi của công nghệ Selenium là webdriver, một tài liệu nhằm chuẩn hoá quá trình phát triển webdriver.

1. Ba thành phần chính của Selenium
  • WebDriver: dùng browser automation APIs được phát triển bởi các trình duyệt Chrome, Firefox,... để điều khiển các trình duyệt và chạy các phép kiểm thử. Selenium webdriver được khuyên dùng bởi tổ chức W3C.
  • IDE: là công cụ được phát triển bởi Selenium để viết và chạy Selenese script. Nó được phát triển là một extension của Chrome and Firefox. Ngoài ra, nó còn được sử dụng để record những hành động của người dùng trên một trang web.
Figure 2: Công cụ tạo test case trong hệ thống sinh thái Selenium.
  • Grid: Selenium grid là một công cụ cho phép bạn chạy các phép kiểm thử (test cases) trên nhiều máy tính khác nhau với kết hợp các loại trình duyệt và hệ điều hành khác nhau.

2. Ví dụ

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located

#This example requires Selenium WebDriver 3.13 or newer
with webdriver.Firefox() as driver:
    wait = WebDriverWait(driver, 10)
    driver.get("https://google.com/ncr")
    driver.find_element(By.NAME, "q").send_keys("cheese" + Keys.RETURN)
    first_result = wait.until(presence_of_element_located(By.CSS_SELECTOR, "h3>div"))
    print(first_result.get_attribute("textContent"))

Algorithm 1: Đoạn code mẫu để dùng Selenium từ Python Selenium client API.

Giải thuật 1 đưa ra  một ví dụ về việc dùng Python Selenium Client API để khởi tạo trình duyệt Firefox, gửi một search request tới google.com với cụm từ "cheese", sau đó chờ google service trả về kết quả, in ra kết quả.

3. Ứng dụng thực tế

Figure 3: WebDriver và hệ thống sinh thái Selenium.
Các nhà phát triển có dùng Selenium để tạo ra các phép thử cho sản phẩm web của họ. Ngoài ra, họ còn dùng nó để ghi những tương tác giữa người dùng và các trình duyệt, để phân tích dữ liệu người dùng tương tác, để thiết kế UI/UX tốt hơn.
Nếu các bạn có thời gian hãy đọc W3C WebDriver specification.

Khách hàng

Qua bài viết này, chúng tôi cũng muốn giới thiệu với các bạn quy trình hoạt động tư vấn của nhóm chúng tôi như thế nào. Nhóm chúng tôi gồm những người có nhiều kinh nghiệm khác nhau nên sẽ có kiến thức, kinh nghiệm bao quát hơn. Ví dụ, anh Lê Dương có kinh nghiệm về physics sẽ giúp nhóm có kinh nghiệm hơn trong vấn đề tính toán khoa học (scientific computing), học máy (machine learning), tôi thì chuyên về mảng cloud, AI, data science. Nhưng quan trọng nhất, chúng tôi phải xác định hiểu được vấn đề của khách hàng đặt ra trước khi suy nghĩ giải pháp cho vấn đề. Thấu hiểu khách hàng là phương châm trên hết của nhóm chúng tôi. Đồng thời, chúng tôi cũng kết hợp những am hiểu công nghệ và am hiểu văn hoá địa phương để đưa ra những giải pháp cụ thể và phù hợp với khách hàng.

    Ví dụ, khi chúng tôi nhận được yêu cầu về nghiên cứu công nghệ Selenium. Chúng tôi đã đọc tài liệu về Selenium (wiki, documentation, lịch sử) kết hợp với kinh nghiệm kỹ thuật, và yêu cầu thực tế từ anh Lê Dương.

Các bạn fan hãy bình luận bên dưới, nhất là các fan ở Hà Nội.👇👇👇

🐘🐘🐘

Thứ Hai, 3 tháng 8, 2020

HOW-TO: Studying and passing Microsoft Azure certification AI-100 and DP-100 in 3 days!!!

👆👆👆,

I registered and passed AI-100 and DP-100 last week. I registered on last Monday and passed the AI-100 on 29-July-2020 and DP-100 on 30-July-2020 ✌. So, I registered, reviewed materials, and took the exam and passed it in 3 days. It is amazing!!! Hehehe, that maybe just my clickbait. Let's celebrate it first, no matter what!!!
Figure 1: My Microsoft certifications from the Microsoft Certification Dashboard portal.

    Let me tell you what the amazing things were about the exam. I did not know what to expect before the exam happened. I used to the exam format such as going to the hall, and write on the papers. Interestingly, I was taking the last exams 7-8 years ago. You registered the exams online, did the exams on a computer software of PEARSON VUE. Because of the COVID-19 situation, I could register the DP-100 exam at a test center in the city center, which is near my place, and I could only register the AI-100 exam at a quite far-away region. I found taking the exam in the far-away test center is more interesting because their measures for COVID-19 is less stringent. I must wear a mask,  and further I need to wear a pair of gloves in the test center in city area. I think a pair of gloves is redundant and reducing their profits during the pandemic 😀. You can wash your hands of viruses with soap, and all your viruses would be washed away, and the situation in Singapore is not that bad. By the way, their gloves were very nice 🧤!!! If you are know how to use a computer software, then you don't need to wary about the test software. After you clicked the button "Finished", your scores would come out immediately 😀. I never have experienced a kind of tests like that, from admitting to university, tests in schools..., and I need to wait at least a few days or months to know whether I pass or fail. This is very amusing to me.

    That is how I passed AI-100 Designing and Implementing an Azure AI Solution with the score of 717, and DP-100 Designing and Implementing a Data Science Solution on Azure with the score of 816. By the way, you need at least 700 the pass the certification.

Now coming to the main story...

Reviewing for two exams

Before the exam, I don't know how to review for the exams, because I never takes any cloud platform or technology exams. I did some searches online and read around some documents in Microsoft Learn websites. Microsoft did a good job to build the learning resources for their technologies and also for preparing for the certification exams. My company also hires an instructor to teach us the two modules, and he also gave an sample exam paper. But I found this exam paper is not really relevant, and their answers are controversial.
    Let's stick with Microsoft (MS) resources for training yourself and preparing for the exam. If your company has an instructor for you, that is great! Learning with interactions would be easier than learning on your owns. First, I would remind you that MS has a portal of anything can be certified, from there, you can navigate into your wanted certification and its learning resources.

DP-100:

The learning path is here. There is a github repo accompanying with the Online-Free course: https://github.com/MicrosoftLearning/DP100. The first module focuses on developing machine learning pipelines with Azure Machine Learning designer with no codes. The second modules teaches what and how to use Azure Machine Learning SDK (Python) to design machine learning pipelines. If a instructor were to teach you, he also cover the contents similar two modules and the github pipeline.

Figure 2: Learning path for DP-100 including two modules.

Let's look at what it is covered in the second module learning Azure Machine Learning SDK
  • Introduction to Azure Machine Learning
  • Train a machine learning model with Azure Machine Learning
  • Working with Data in Azure Machine Learning
  • Working with Compute Contexts in Azure Machine Learning
  • Orchestrating machine learning with pipelines
  • Deploying machine learning models with Azure Machine Learning
  • Deploy batch inference pipelines with Azure Machine Learning
  • Tune hyperparameters with Azure Machine Learning
  • Automate machine learning model selection with Azure Machine Learning
  • Explain machine learning models with Azure Machine Learning
  • Monitor models with Azure Machine Learning
  • Monitor data drift with Azure Machine Learning
Please remember "practice makes it perfect"! There are many questions regarding reading a segment of Python codes, or filling the blank with codes. There is NDA (Non-disclosure agreement) that I signed with MS, hence, I cannot disclose anything further. 

Practice! Practice! Practice! You can register a new Azure account with an email account with some free credits (I remembered around 300$). With that amount, you can practice your skills. When practicing, let focus on setting up an Azure Machine Learning workspace, running experiments and training models, optimizing and managing models, deploying and consuming models. They are as usual as we are doing in jobs as data scientists.

AI-100:
For AI-100, we can follow the same study guides as DP-100. Remembering MS is a nice guy 😆, wants to validate your skills only, and practice makes it perfect.
Figure 3: Learning path for AI-100 including four modules
I found the following github very helpful for reviewing materials after practicing: https://github.com/meet-bhagdev/ai-100

To summarize, we should follow the learning path recommended by MS and practice the lab sessions provided by MS.

P/S: This post is dedicated to my fellow HannLam Woo.
🐘🐘🐘