Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pages;
- import java.util.List;
- import org.openqa.selenium.By;
- import org.openqa.selenium.WebDriver;
- import org.openqa.selenium.WebElement;
- import org.openqa.selenium.remote.RemoteWebDriver;
- import com.relevantcodes.extentreports.ExtentTest;
- import wrappers.ProjectWrappers;
- public class CreateIOIPage extends ProjectWrappers{
- public CreateIOIPage(RemoteWebDriver driver, ExtentTest test){
- this.driver = driver;
- this.test = test;
- if(!verifyTitle("DBVX",driver)){
- reportStep("This is not Home Page", "FAIL",driver);
- }
- }
- public CreateIOIPage clickCCYDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.CCY.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage enterCCY(String data,RemoteWebDriver driver) {
- mouseOverEnterByXpath(prop.getProperty("Home.EnterCCY.Xpath"), data,driver);
- return this;
- }
- public CreateIOIPage enterAmount(String data,RemoteWebDriver driver) {
- enterByXpath(prop.getProperty("Home.Amount.Xpath"), data,driver);
- return this;
- }
- public CreateIOIPage clickAccDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Account.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage enterAccDropdown(String data,RemoteWebDriver driver) {
- mouseOverEnterByXpath(prop.getProperty("Home.EnterAccount.Xpath"), data,driver);
- return this;
- }
- public CreateIOIPage clickMaturityDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Maturity.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage clickExpandDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Tenor.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage clickTenorDate(String data,RemoteWebDriver driver) throws InterruptedException{
- clickByXpath("//div[text()='"+data+"']",driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage clickSettleDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Settle.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage enterSettleDropdown(String data,RemoteWebDriver driver) {
- mouseOverEnterByXpath(prop.getProperty("Home.Settle.Xpath"), data,driver);
- return this;
- }
- public CreateIOIPage clickProductDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Product.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage enterProductDropdown(String data,RemoteWebDriver driver) {
- mouseOverEnterByXpath(prop.getProperty("Home.EnterProduct.Xpath"), data,driver);
- return this;
- }
- public CreateIOIPage clickRateDropdown(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Rate.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage enterRateDropdown(String data,RemoteWebDriver driver) throws InterruptedException {
- mouseOverEnterByXpath(prop.getProperty("Home.EnterRate.Xpath"), data,driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage clickInvestButton(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Invest.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage clickSubmitButton(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Submit.Xpath"),driver);
- Thread.sleep(3000);
- return this;
- }
- /*public HomePage verifyProduct(String data) throws InterruptedException{
- verifyTextByXpath("(//div[@class='whiteboard__whiteboard-list'])[1]//div[@class='instrument'and text()='"+data+"']",data);
- //Thread.sleep(3000);
- return this;
- }*/
- public CreateIOIPage verifyProduct(String data,String data1,String data2,RemoteWebDriver driver) throws InterruptedException{
- //if (getTextByXpath("(//div[@class='whiteboard__whiteboard-list'])[1]//div[@class='instrument'and text()='"+data+"']").equals(data) ) {
- if ((getTextByXpath("((((//div[@class='whiteboard__whiteboard-list'])[1]//div[@class='instrument'and text()='"+data+"'])/ancestor::div[@class='whiteboard__field-wide'])/following-sibling::div[@class='whiteboard__field-wide'])[1]",driver)==data1) && (getTextByXpath("((((//div[@class='whiteboard__whiteboard-list'])[1]//div[@class='instrument'and text()='"+data+"'])/ancestor::div[@class='whiteboard__field-wide'])/following-sibling::div[@class='whiteboard__field-medium whiteboard__field-direction'])",driver)==data2)) {
- System.out.println("success");
- }
- //verifyTextByXpath("(//div[@class='whiteboard__whiteboard-list'])[1]//div[@class='instrument'and text()='"+data+"']",data);
- //Thread.sleep(3000);
- return this;
- }
- public CreateIOIPage clickActiveGrid(String data,RemoteWebDriver driver) throws InterruptedException{
- clickByXpath("((//div[@class='whiteboard__whiteboard-list'])[1]//div[@class='instrument'and text()='"+data+"']/../../../preceding-sibling::div/img)",driver);
- Thread.sleep(5000);
- return this;
- }
- public CreateIOIPage clickAcceptButton(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.Accept.Xpath"),driver);
- Thread.sleep(4000);
- return this;
- }
- public CreateIOIPage clickOpenTrades(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.OpenTrades.Xpath"),driver);
- Thread.sleep(4000);
- return this;
- }
- public CreateIOIPage FilterProduct(String data,RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.FilterProduct.Xpath"),driver);
- Thread.sleep(2000);
- enterByXpath(prop.getProperty("Home.SearchBox.Xpath"), data,driver);
- Thread.sleep(2000);
- clickByXpath(prop.getProperty("Home.SelectAll.Xpath"),driver);
- Thread.sleep(2000);
- clickByXpath("//span[text()='"+data+"']",driver);
- Thread.sleep(2000);
- return this;
- }
- public CreateIOIPage FilterDirection(String data,RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.FilterDirection.Xpath"),driver);
- Thread.sleep(2000);
- enterByXpath(prop.getProperty("Home.SearchBox.Xpath"), data,driver);
- Thread.sleep(2000);
- clickByXpath(prop.getProperty("Home.SelectAll.Xpath"),driver);
- Thread.sleep(2000);
- clickByXpath("//span[text()='"+data+"']",driver);
- Thread.sleep(2000);
- clickByXpath(prop.getProperty("Home.CommonPoint.Xpath"),driver);
- Thread.sleep(2000);
- return this;
- }
- public CreateIOIPage FilterAmount(String data,RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.FilterAmount.Xpath"),driver);
- Thread.sleep(2000);
- enterById(prop.getProperty("Home.SearchBox.ID"), data,driver);
- Thread.sleep(2000);
- clickByXpath(prop.getProperty("Home.CommonPoint.Xpath"),driver);
- Thread.sleep(2000);
- return this;
- }
- public CreateIOIPage FilterCCY(String data,RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.FilterCCY.Xpath"),driver);
- Thread.sleep(2000);
- enterByXpath(prop.getProperty("Home.SearchBox.Xpath"), data,driver);
- Thread.sleep(2000);
- clickByXpath(prop.getProperty("Home.SelectAll.Xpath"),driver);
- Thread.sleep(2000);
- clickByXpath("//span[text()='"+data+"']",driver);
- Thread.sleep(2000);
- clickByXpath(prop.getProperty("Home.CommonPoint.Xpath"),driver);
- Thread.sleep(2000);
- return this;
- }
- public CreateIOIPage VerifyOpenTrades(String data1,String data2,String data3,String data4,String data5,RemoteWebDriver driver) throws InterruptedException{
- //clickByXpath("//label[text()='Open Trades']");
- List<WebElement> allRows=driver.findElementsByXPath("(//div[@class='ag-body-container'])/div");
- System.out.println("Number of rows available " +allRows.size());
- for (WebElement eachRow : allRows) {
- System.out.println("EachRow text value " +eachRow.getText());
- String str=eachRow.getText();
- if(str.contains(data1) && str.contains(data2) && str.contains(data3) && str.contains(data4) && str.contains(data5)) {
- eachRow.findElement(By.xpath("(//div[@class='ag-body-container'])//div[@class='action-button']")).click();
- break;
- }
- /* String tradeDetails[]=str.split("\n");
- System.out.println("length of string is " +tradeDetails.length);
- for(i=0;i<tradeDetails.length;i++) {
- System.out.println("trade is " +tradeDetails[i]);
- //System.out.println("trade id is " +tradeDetails[1]);
- }*/
- /*
- WebElement tradeID=eachRow.findElement(By.xpath("((//div[@class='ag-body-container'])//div[contains(@class,'ag-cell-no-focus ag-cell ag-cell-not-inline-editing ag-cell-value')])[2]"));
- System.out.println("The Trade id of IOI is " +tradeID.getAttribute("colId"));
- //String str=eachRow.findElement(By.xpath("((//div[@class='ag-body-container'])//div[contains(@class,'ag-cell-no-focus ag-cell ag-cell-not-inline-editing ag-cell-value')])[2]")).getText();
- String str=eachRow.findElement(By.xpath("//div[contains(@class,'ag-cell-no-focus ag-cell ag-cell-not-inline-editing ag-cell-value')][2]")).getText();
- System.out.println("The Trade id of IOI is " +str);
- */
- }
- Thread.sleep(4000);
- return this;
- }
- public CreateIOIPage clickUnwindSubmitButton(RemoteWebDriver driver) throws InterruptedException{
- clickByXpath(prop.getProperty("Home.UnwindSubmit.Xpath"),driver);
- Thread.sleep(2000);
- return this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement