Tuesday, March 31, 2026

Selenium, Playwright and XPath


I was asked this question.  
What are the types of XPath in Selenium?

I'm sure most would not be shocked by this question  Instead, take it as the right question from an interviewer.

As I heard this question, I asked myself.,
What are the types of XPath in Playwright?

Isn't that fair to ask so?


In simple, the Selenium and Playwright do not have their types of XPath.  In fact, the XPath has nothing to do with Selenium and Playwright.

The XPath was created by W3C before the Selenium came to the world.

The XPath is built by W3C and used by the browser to traverse a XML document.  

By the way, XPath means XML Path.  The XPath is an expression or query to locate the node or element or attribute or what is of interest in the XML document.

The creator of Selenium used the XPath to locate an web element on a web page which is a HTML document -- a XML.

The Playwright also does the same.  It uses the XPath to traverse and locate a web element on a web page.

However, XPath has two ways to traverse and locate a node in XML or a web element in HTML page.  That is,

  1. Absolute XPath
  2. Relative XPath
These are the two types offered by W3C to traverse a XML document using XPath.


LLM and Its Training for Software Test Engineering


The LLMs are trained by the data and information on internet.  When the internet is filled with such contents which are incorrect, noise, and misleading, the LLM offers the same.

In my opinion, that question asked about the types of XPath in Selenium and Playwright is technically incorrect.  Looks like the question is picked from the web or from a LLM's response.

The LLMs are useful when it is trained on the well reasoned information and data, and when it is questioned in the better ways.

The people are accepting whatever LLMs respond and advocating that is right!  Beware!

Let us give the better data to LLMs for its training.  This is very much needed to the Software Testing and Test Engineering related training.  




Question the LLMs in your prompts and conversation.  It can assist better.  You should know when to say no for what it is responding.  The XPath and its types are independent of any web automation libraries and tools.  The web automation libraries and tools make use of the XPath to traverse and locate a web element, a property or a attribute of an element in web page.

The latest XPath version available is 3.1.  It is said, the popular browsers which we use supports natively for XPath 1.0 alone.  That is, the popular browsers do not natively support the latest version of XPath.   The XPath 1.0 became a recommendation in 1999.


Tuesday, March 24, 2026

Tests for the CSS and JS Fixes on My Blog


I implemented the code block and line highlighting in my blog.  This blog post will serve as a litmus test for the CSS and JS that I have written for my blog.


Class TestingGarage {
	public static void Main (String args[]) {
		System.out.println("testing the css and js fixes");
	}
}

Class TestingGarage {
	public static void Main (String args[]) {
		System.out.println("testing the css fixes");
	}
}

original_string = "stressed"
reversed_string = ""
for char in original_string:
    reversed_string = char + reversed_string
print(reversed_string)
# output: desserts

SELECT MAX(Salary) AS HighestSalary FROM Employee;

pm.test("Check a value in an array", () => {
  const items = responseJson.data.items;
  // Check if 'productCode' "XYZ" exists in any item in the array
  const productExists = items.some(item => item.productCode === "XYZ");
  pm.expect(productExists).to.be.true;
});

  
    

/* Header
----------------------------------------------- */
.header-outer {
background: transparent none repeat-x scroll 0 -400px;
_background-image: none;
}
.Header h1 {
font: normal normal 40px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
color: #000000;
text-shadow: 0 0 0 rgba(0, 0, 0, .2);
}
.Header h1 a {
color: #000000;
}
.Header .description {
font-size: 14px;
color: #000000;
}
.header-inner .Header .titlewrapper {
padding: 22px 0;
}
.header-inner .Header .descriptionwrapper {
padding: 0 0;
}


.header-outer {
background: transparent none repeat-x scroll 0 -400px;
_background-image: none;
}
.Header h1 {
font: normal normal 40px Georgia, Utopia, 'Palatino Linotype', Palatino, serif;
color: #000000;
text-shadow: 0 0 0 rgba(0, 0, 0, .2);
}
.Header h1 a {
color: #000000;
}
.Header .description {
font-size: 14px;
color: #000000;
}
.header-inner .Header .titlewrapper {
padding: 22px 0;
}
.header-inner .Header .descriptionwrapper {
padding: 0 0;
}

function login(user) {
  if (!user) {
    throw new Error("User required");
  }
  return true;
}

// comment
console.log("Hello");

/*
console.log("Hello");
*/

function login(user) {
  if (!user) {
    throw new Error("User required");
  }
  return true;
}

adb logcat -v threadtime | grep -E "FATAL|Exception|Crash|ANR"

adb logcat --pid=$(adb shell pidof com.example.app) -v threadtime

function login(user) {
if (!user) {
throw new Error("User required");
}
 return true;
}

SELECT DISTINCT
    Salary
FROM 
    Employee
ORDER BY 
    Salary DESC
LIMIT 1 OFFSET (N - 1); -- Replace N with the desired rank (e.g. 2 for the second highest)



curl -X PUT \
  https://restful-booker.herokuapp.com/booking/1 \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'Cookie: token=abc123' \
  -d '{
    "firstname" : "James",
    "lastname" : "Brown",
    "totalprice" : 111,
    "depositpaid" : true,
    "bookingdates" : {
        "checkin" : "2018-01-01",
        "checkout" : "2019-01-01"
    },
    "additionalneeds" : "Breakfast"
}'

curl -X PUT \
  https://restful-booker.herokuapp.com/booking/1 \
  -H 'Content-Type: text/xml' \
  -H 'Accept: application/xml' \
  -H 'Authorization: Basic YWRtaW46cGFzc3dvcmQxMjM=' \
  -d ' 
  


Inline blockquote test
# This is a test for the inline blockquote!