Skip to content

Instantly share code, notes, and snippets.

@erajanraja24
Last active September 4, 2017 14:25
Show Gist options
  • Save erajanraja24/09aa7772dc257a5f3f492d63d80836f4 to your computer and use it in GitHub Desktop.
Save erajanraja24/09aa7772dc257a5f3f492d63d80836f4 to your computer and use it in GitHub Desktop.
C099
package com.test.on;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import come.ExcelReadWrite.ExcelRead;
public class Co99 extends Wrapper{
public static void co99Script() throws IOException
{
initialSetUp();
login();
execute();
}
public static void initialSetUp()
{
launchBrowser("Chrome");
navigateTo("https://www.99.co");
maximizeTheBrowserWindow();
sleep(1500);
//
}
public static void login() throws IOException
{
clickByLinkText("Log in");
sleep(2000);
enterTextInTextbox("name","email_or_phone",ExcelRead.username());
enterTextInTextbox("name","password",ExcelRead.password());
driver.findElement(By.name("password")).submit();
//click("className","buttonInnerContainer___3XgR-");
sleep(2000);
}
public static void execute() throws IOException
{
sleep(1500);
int size = driver.findElements(By.tagName("iframe")).size();
for(int i=0; i<=size; i++)
{
driver.switchTo().frame(i);
int total=driver.findElements(By.className("intercom-borderless-dismiss-button")).size();
System.out.println(total);
if(total==1)
{
click("xpath","//div[@class='intercom-borderless-dismiss-button']");
}
driver.switchTo().defaultContent();
}
/*WebElement frame=driver.findElement(By.className("intercom-borderless-dismiss-button"));
driver.switchTo().frame(frame);
if(driver.findElements(By.xpath("//div[@class='intercom-launcher-close-icon']")).size()>0)
{
System.out.println("pop Up came");
click("xpath","//div[@class='intercom-borderless-dismiss-button']");
}
driver.switchTo().defaultContent();*/
clickByLinkText("List property");
sleep(1500);
enterTextInTextbox("xpath","//div/input[@placeholder='Search by name, address or postal code']",ExcelRead.getvalue(3, 1, "Sheet1", "Upload_Sequence.xlsx"));
sleep(1500);
click("id","react-autowhatever-1--item-0");
sleep(1500);
//Select the Generic Class
click("xpath","//div[@class='UnitTypeInput__headings-ctn']/ul/li/a[contains(text(),'GENERIC')]");
//Enter the Room count
click("xpath","//div[@class='UnitTypeInput__selector-title' and contains(text(),'1')]");
//click("xpath","//div[@class='UnitTypeInput__selector-title' and contains(text(),'"+ExcelRead.getvalue(4, 1, "Sheet1", "Upload_Sequence.xlsx")+"')]");
//Enter Land size
enterTextInTextbox("xpath","//input[@placeholder='Enter size (sqft/sqm)']",ExcelRead.getvalue(5, 1, "Sheet1", "Upload_Sequence.xlsx"));
click("xpath","//div[contains(text(),'SQM')]");
//Enter build up area
enterTextInTextbox("xpath","//input[@placeholder='Price in SGD']",ExcelRead.getvalue(6, 1, "Sheet1", "Upload_Sequence.xlsx"));
//Click on the Next button
click("className","ListingCreationForm__next-button");
/* In the Third section*/
//Enter the description
enterTextInTextbox("xpath","//div[@class='OptionalDetails']/section/div/div/textarea[@placeholder='' and @rows='4']",ExcelRead.getvalue(11, 1, "Sheet1", "Upload_Sequence.xlsx"));
//No Of BR
enterTextInTextbox("xpath","//div[@class='ListingCreationForm__field']/div/input[@class='input-box' and @type='text' and not(@placeholder)]",ExcelRead.getvalue(8, 1, "Sheet1", "Upload_Sequence.xlsx"));
//Date of avail
enterTextInTextbox("xpath","//input[@placeholder='DD-MM-YYYY']",ExcelRead.getvalue(15, 1, "Sheet1", "Upload_Sequence.xlsx"));
//Furnishing
if(ExcelRead.getvalue(9, 1, "Sheet1", "Upload_Sequence.xlsx")=="FF")
{
click("xpath","//div[@class='btn-group-vertical']/span[@contains(text(),'Fully Furnished')]");
}
else if(ExcelRead.getvalue(9, 1, "Sheet1", "Upload_Sequence.xlsx")=="PF")
{
click("xpath","//div[@class='btn-group-vertical']/span[@contains(text(),'Partially Furnished')]");
}
//Select amenites(aircon
click("xpath","//div[@class='CheckboxInput__ctn']/div[contains(text(),'Aircon')]");
//Next
click("className","ListingCreationForm__next-button");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment