Posts

Showing posts from July, 2024

How many types of xpath are there?

 In Selenium, there are mainly two types of XPath used for locating elements: 1. Absolute XPath: This XPath starts from the root node and follows the complete path to the element. It is highly specific and is dependent on the structure of the HTML document. Example: /html/body/div[1]/div[2]/div[1]/span 2. Relative XPath: This XPath starts from any element in the HTML document (not necessarily from the root). It is more flexible and commonly used because it is less likely to break if the structure of the page changes slightly. Example: //div[@class='example'] Additionally, XPath can be classified by the type of syntax used for selecting elements: Attribute-based XPath: Selects elements based on their attributes (e.g., id, class, name, etc.). Example: //input[@name='username'] Text-based XPath: Selects elements based on their text content. Example: //button[text()='Submit'] Contains() function: Allows partial matching of attributes or text. Example: //a[contains(@...

↗ Static vs ↗ Non-static:

  In JAVA Context ↗ Static:  Static members (variables and methods) are associated with the class itself rather than with individual instances. ↗ Non-Static:  Non-static members are specific to each instance of a class, as they are tied to objects created from the class. ↗ Memory allocation --------------------- ↗ Static :  Static members are allocated memory only once, at the time of class loading. They are shared among all instances of the class. ↗ Non-static:  Non-static members have memory allocated separately for each instance of the class. Each object has its own copy of non-static members.