Alex : Hey Mia, I’ve been hearing a lot about Selenium lately. I know it’s used for testing, but I’m not exactly sure how it works. Can you explain?
Mia : Of course, Alex! Selenium is a powerful tool we use to automate browsers. It basically allows you to write scripts that perform user-like actions on a website—like typing into input fields or clicking buttons.
Alex : Oh, like simulating a real user?
Mia :
Good question. A few reasons:
- It’s open-source and free.
- It works great with JavaScript via Node.js.
- It supports all the major browsers—Chrome, Firefox, Edge—you name it.
- And most importantly, it helps QA teams write automated tests that run faster and more reliably than manual ones.
Alex: That sounds awesome. But how does it help us in QA specifically?
Mia: Good question. We use it to automate repetitive tasks—like login forms, navigation, or filling out forms. It’s also great for regression testing after a new release. Rather than doing everything manually, we let Selenium handle it.
Alex: That must save a lot of time.
Mia: It really does. Plus, it helps catch bugs early by testing key features automatically every time we push a change.
Alex: I’m interested! How do I start using Selenium with JavaScript?
Mia: Let me show you a simple example. Here’s a basic test script using Selenium and JavaScript
Alex: Okay, let me see if I understand. This script:
- Opens Chrome,
- Goes to the website,
- Types in the username and password,
- Clicks the login button,
- Waits for the dashboard to load,
- And then closes the browser.
Mia: Spot on! That’s the flow. You’re already getting the hang of it.
Alex: Awesome! What are the main commands I should memorize?
Mia: Here’s a quick list:
- driver.get(url) – opens a web page
- driver.findElement(By.<type>) – finds an element by name, ID, etc.
- .sendKeys(‘text’) – types into a field
- .click() – clicks a button or link
- driver.quit() – closes the browser
- driver.wait(…) – waits for an element or condition to be met
Alex: This is super clear. Is this how we write most of our test automation scripts?
Mia: Yes, this is the foundation. As you get more comfortable, we can build more advanced flows—like testing dropdowns, alerts, file uploads, or even running tests in parallel.
Alex: I can’t wait to try it out. Thanks, Mia. You made it a lot less intimidating!
Mia: Anytime, Alex. Let’s pair up next week and write your first full test case together.




