public class InstagramSignupAutomation {
static String[] firstNames = {"Arun", "Karthik", "Venkat", "Ananya", "Divya"};
static String[] lastNames = {"Reddy", "Iyer", "Pillai", "Nair", "Menon"};
static String targetProfile = "yshsbbsua"; // Change to the profile you want to
follow
public static void main(String[] args) {
[Link]("[Link]", "C:\\Users\\sk asif\\
Downloads\\chromedriver-win64\\[Link]");
ChromeOptions options = new ChromeOptions();
[Link]("--disable-blink-features=AutomationControlled");
WebDriver driver = new ChromeDriver(options);
WebDriverWait wait = new WebDriverWait(driver, [Link](20));
for (int i = 0; i < 10; i++) { // Run 10 cycles for testing
try {
[Link]("Cycle #" + (i + 1));
[Link]("[Link]
String firstname = generateRandomName();
String username = generateUsername(firstname);
String mailpassword = "Test@12345";
creategmailaccount(driver, wait, firstname,username, mailpassword);
[Link](3000);
} catch (Exception e) {
[Link]();
}
}
[Link]();
}
private static void creategmailaccount(WebDriver driver, WebDriverWait wait,
String firstname, String username, String mailpassword) {
try {
WebElement firstNameField =
[Link]([Link]([Link]("firstName")));
// Simulate human-like typing for first name
for (char c : [Link]()) {
[Link]([Link](c));
[Link](200 + (int)([Link]() * 300)); // Random delay
between keystrokes
}
// Click 'Next' to move to the date of birth and gender page
WebElement nextButton =
[Link]([Link]("//span[text()='Next']"));
[Link]();
// Wait for date of birth and gender fields
WebElement dayField =
[Link]([Link]([Link]("day")));
WebElement monthDropdown = [Link]([Link]("month"));
WebElement yearField = [Link]([Link]("year"));
WebElement genderDropdown = [Link]([Link]("gender"));
// Fill in date of birth (example: 15th August 1995)
for (char c : "15".toCharArray()) {
[Link]([Link](c));
[Link](200 + (int)([Link]() * 300));
}
[Link](2000);
[Link]();
[Link](2000);
WebElement monthOption =
[Link]([Link]("//option[text()='August']"));
[Link]();
[Link](2000);
for (char c : "1995".toCharArray()) {
[Link]([Link](c));
[Link](200 + (int)([Link]() * 300));
}
// Select gender from dropdown (example: Male)
[Link]();
WebElement genderOption =
[Link]([Link]("//option[text()='Male']"));
[Link]();
[Link](2000);
// Click 'Next' to move to the email selection page
nextButton = [Link]([Link]("//span[text()='Next']"));
[Link]();
[Link](3000);
// Locate the "Create your own Gmail address" element and click it
WebElement customGmailButton =
[Link]([Link]("//div[contains(text(),'Create your own Gmail
address')]") );
[Link]();
[Link](3000);
WebElement usernameField =
[Link]([Link]("//input[@name='Username']"));
// Simulate human-like typing for username
for (char c : [Link]()) {
[Link]([Link](c));
[Link](200 + (int)([Link]() * 300));
}
[Link](2000);
// Click 'Next' to move to the password page
nextButton = [Link]([Link]("//span[text()='Next']"));
[Link]();
[Link](2000);
//
// Locate the "Password" input field and enter a value
WebElement passwordField =
[Link]([Link]("//input[@name='Passwd']"));
for (char c : [Link]()) {
[Link]([Link](c));
[Link](200 + (int)([Link]() * 300));
}
[Link](1000);
// Locate the "Confirm Password" input field and enter a value
WebElement confirmPasswordField =
[Link]([Link]("//input[@name='PasswdAgain']"));
for (char c : [Link]()) {
[Link]([Link](c));
[Link](200 + (int)([Link]() * 300));
}
[Link](1000);
// Click 'Next' to complete the signup
nextButton = [Link]([Link]("//span[text()='Next']"));
[Link]();
[Link](3000);
} catch (Exception e) {
[Link]();
}
}
public static boolean fillUsername(WebDriver driver, String username) {
WebDriverWait wait = new WebDriverWait(driver, [Link](10));
List<WebElement> elements = [Link]([Link]("uxXgMe"));
if (![Link]()) {
WebElement createOwnOption =
[Link]([Link]([Link]("[jsname='CeL6Qc'
]")));
[Link]();
}
[Link]([Link]([Link]("Username")));
WebElement usernameField;
if (,'Create your own
Gmail address')]")).isEmpty()) {
WebElement customGmailButton =
[Link]([Link]("//div[contains(text(),'Create your own Gmail
address')]") );
[Link]();
try {
[Link](3000);
} catch (InterruptedException e) {
[Link]().interrupt();
}
}
usernameField = [Link]([Link]("//input[@name='Username']"));
[Link]();
for (char c : [Link]()) {
[Link]([Link](c));
try {
[Link](200 + (int)([Link]() * 300));
} catch (InterruptedException e) {
[Link]().interrupt();
}
}
try {
[Link](2000);
} catch (InterruptedException e) {
[Link]().interrupt();
}
WebElement nextButton = [Link]([Link]("VfPpkd-LgbsSe"));
[Link]();
try {
[Link](2000);
} catch (InterruptedException e) {
[Link]().interrupt();
}
return true;
}
public static String generateRandomName() {
Random random = new Random();
String firstName = firstNames[[Link]([Link])];
String lastName = lastNames[[Link]([Link])];
return firstName + " " + lastName;
}
public static String generateUsername(String fullName) {
Random random = new Random();
int randomNumber = 1000 + [Link](9000);
return ([Link](" ", ".") + randomNumber).toLowerCase();
}