Thursday, October 17, 2024

Easy Steps to Navigate a Site Like a Pro

Manually exploring a site involves checking its various features, functionality, and usability. Here's a comprehensive checklist:

Home Page:
1. Verify page layout and design
2. Check the navigation menu and links
3. Validate search functionality (if present)
4. Review hero section/content

Inner Pages:
1. About Us
2. Contact/Support
3. FAQ
4. Blog (if present)
5. Terms and Conditions
6. Privacy Policy

Features and Functionality:
1. User registration/login
2. Payment gateway integration (if applicable)
3. Search filters and sorting
4. Product/service details pages
5. Reviews and ratings (if present)
6. Commenting system (if present)

User Experience (UX):
1. Responsive design (mobile, tablet, desktop)
2. Page loading speed
3. Navigation and menu usability
4. Content readability
5. Error handling and messaging

Security:
1. HTTPS encryption
2. Password hashing and storage
3. Input validation and sanitization
4. CSRF protection
5. Secure payment processing

Accessibility:
1. Screen reader compatibility
2. Keyboard navigation
3. High contrast mode
4. Closed captions (if video content)

Browser and Device Compatibility:
1. Test on multiple browsers (Chrome, Firefox, Safari, Edge)
2. Test on different devices (desktop, laptop, mobile, tablet)
3. Verify consistency across devices and browsers

Other:
1. Social media integration
2. Newsletter subscription
3. Contact form functionality
4. Map integration (if present)
5. Third-party services integration (e.g., analytics)

Tuesday, October 1, 2024

Run two browsers simultaneously in Selenium

 package TEST;


import org.openqa.selenium.WebDriver;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.firefox.FirefoxDriver;


public class Selenium_Latest {


public static void main(String[] args) {

// Create and start two threads, one for each browser.

Thread chromeThread = new Thread(new BrowserRunnable("chrome"));

Thread firefoxThread = new Thread(new BrowserRunnable("firefox"));


chromeThread.start();

firefoxThread.start();

}


}


// Runnable class for launching a browser

class BrowserRunnable implements Runnable {

private String browserType;


public BrowserRunnable(String browserType) {

this.browserType = browserType;

}


@Override

public void run() {

WebDriver driver = null;


if (browserType.equals("chrome")) {

driver = new ChromeDriver();

} else if (browserType.equals("firefox")) {

driver = new FirefoxDriver();

}


if (driver != null) {

driver.get("https://suriyaparithy.blogspot.com/");


// Optionally, get the title and print it for each browser

String title = driver.getTitle();

System.out.println(browserType + " Browser - Page Title: " + title);


// Closing the browser after operation

driver.quit();

}

}

}

Tuesday, July 30, 2024

Difference Between Global, Environment, and Collection Variables in Postman

Global Variables:
  • Stored globally across all requests and collections.
  • It can be accessed from any request or collection.
  • Use cases: API keys, common headers, or base URLs
Environment Variables:
  • Stored within a specific environment (e.g., dev, staging, prod).
  • It can be accessed only from requests within the same environment.
  • Use cases: Environment-specific settings, such as URLs, credentials, or timeouts.
Collection Variables:
  • Stored within a specific collection.
  • It can be accessed only from requests within the same collection.
  • Use cases: Collection-specific settings, such as API endpoints, headers, or query parameters.

Monday, July 29, 2024

Selenium XPath in detail

What is XPATH?
  • It is an XML path.
  • It is one of the locator types in selenium.
  • It uses path expression to navigate in XML documents and to identify a node or number of nodes.
  • XPath is used to handle complex and dynamic paths.
 
Types of XPATH in Selenium:
  1. Absolute XPath
  2. Relative XPath
 
What is Absolute XPath?
  • Absolute path starts from <HTML> tag.
  • It uses / ( forward slash ).
  • It is used to identify any element direct way by consider all the tag starts from <HTML> tag.
  • It is much more faster than "Relative xpath" as it holds the direct path to the target node/tag/element from start <Html> tag.
  • But we will mostly use this one if it holds a long string path and is difficult to maintain or handle. It is not a shortend path.
 
What is Relative XPath?
  • It uses //  ("forward double slash") .
  • It will consider any node/element/tag as a refernce point from where either we can traverse forard or reverse direction to identify target node/tag.
  • It is mostly used as we are considering any node as a reference node (stable node) from a DOM.

Saturday, July 27, 2024

Java code to automate the extraction of two numbers from a web page

 package system;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;

public class Practice {

   WebDriver driver;

@BeforeMethod
public void setUp() {
  WebDriverManager.chromedriver().setup();
  driver = new ChromeDriver();
}

@Test(description = "extraction of two numbers from a web page")
public void test() throws InterruptedException {

driver.get("https://ultimateqa.com/complicated-page");

// Locate the element containing the CAPTCHA question
WebElement captchaElement = driver.findElement(By.className("et_pb_contact_captcha_question"));

// Extract the CAPTCHA question text
String captchaText = captchaElement.getText().trim(); // Example: "5 + 6"

// Split the text to get the operands
String[] parts = captchaText.split("\\+");
int firstNumber = Integer.parseInt(parts[0].trim());
int secondNumber = Integer.parseInt(parts[1].trim());

// Calculate the sum
int sum = firstNumber + secondNumber;

// Print the sum (for debugging purposes)
System.out.println("Extracted Numbers: " + firstNumber + " + " + secondNumber + " = " + sum);

// Enter the sum into the CAPTCHA input field
WebElement captchaInputField = driver.findElement(By.className("et_pb_contact_captcha"));
captchaInputField.sendKeys(String.valueOf(sum));
}
}