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(@...

Test cases for login page.



When testing a login page, it's important to cover various scenarios to ensure its functionality and security. Here are some test cases you can consider for testing a login page:


  • Valid credentials: Enter valid username and password and verify that the user is successfully logged in.
  • Invalid username: Enter an invalid username and a valid password, and verify that an appropriate error message is displayed.
  • Invalid password: Enter a valid username and an invalid password, and verify that an appropriate error message is displayed.
  • Empty username: Leave the username field empty and enter a valid password, and verify that an appropriate error message is displayed.
  • Empty password: Enter a valid username and leave the password field empty, and verify that an appropriate error message is displayed.
  • Case sensitivity: Verify that the login is case-sensitive for both username and password fields.
  • Account lockout: After a specified number of consecutive failed login attempts, verify that the account is locked and further login attempts are prevented.
  • "Remember Me" functionality: Check the "Remember Me" checkbox and verify that the user remains logged in even after closing and reopening the browser.
  • Forgot password: Test the "Forgot Password" feature by entering a valid username or email address, and verify that a password reset link or instructions are sent to the user.
  • Session timeout: Verify that the user is automatically logged out after a specified period of inactivity.
  • Cross-site scripting (XSS): Enter a username or password containing HTML or JavaScript tags, and ensure that the input is properly sanitized to prevent XSS attacks.
  • Brute force attack prevention: Perform a series of rapid login attempts with both valid and invalid credentials and verify that the system detects and blocks suspicious behavior.
  • Concurrent sessions: Test the system's behavior when the same user logs in from multiple devices or browsers simultaneously.
  • Social media login: Test the functionality of logging in using social media accounts (e.g., Facebook, Google) and ensure the integration works correctly.
  • Compatibility: Test the login page on different browsers, operating systems, and devices to ensure cross-compatibility.

Negative Test Cases For Login Page

  • Check if a user can log in with an expired password or not.
  • Check if an unverified user can log in to the application or not.
  • Check if the login functionality with blank fields
  • Check the login functionality with SQL injections
  • Check if the login functionality with incorrect email addresses and passwords.

Comments

Popular posts from this blog

IRetryAnalyzer

How many types of xpath are there?