Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

package po;

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;



public class EDI_2pdiDisplayedPO {
WebDriver driver;

public EDI_2pdiDisplayedPO(WebDriver driver){
this.driver = driver;
PageFactory.initElements(driver, this);
}

@FindBy(id="IPT_pdiLookup_ewv_1")
private WebElement inputPDI;

@FindBy(xpath = "//div[@class = 'button primary small right']")
private WebElement drpButton;

@FindBy(xpath = "//div[@class = 'button-drop-content']/a[1]")
private WebElement drpCompare;

@FindBy(xpath = "(//*[@id='TBL_headerInfo_ewv_1'])[1]/tbody/tr[1]/td[4]")
//*[@id="TBL_headerInfo_ewv_1"]/tbody/tr[1]/td[4]
private WebElement leftPDI;

@FindBy(xpath = "(//*[@id='TBL_headerInfo_ewv_1'])[2]/tbody/tr[1]/td[4]")
private WebElement rightPDI;

@FindBy(xpath = "//div[@class = 'ewv-title-bar']/div/h1[1]/span[2]")
private WebElement labelLeft;

@FindBy(xpath = "//div[@class = 'ewv-title-bar']/div/h1[2]/span[2]")
private WebElement labelRight;

@FindBy(xpath = "//label[@for = 'ACC_vendorInfo_ewv_1']")
private WebElement accVendorLeft;

@FindBy(xpath = "//label[@for = 'ACC_vendorInfo_ewv_2']")
private WebElement accVendorRight;



public void getWindowSplitted(String pdi) {
WebDriverWait wait = new WebDriverWait(driver,25);
wait.until(ExpectedConditions.visibilityOf(inputPDI));

// jse.executeScript("arguments[0].setAttribute('value', '" + pdi +"')", inputPDI);
inputPDI.sendKeys(pdi);
Actions action = new Actions(driver);
action.moveToElement(drpButton).build().perform();
drpButton.click();
action.moveToElement(drpCompare).build().perform();
JavascriptExecutor js = (JavascriptExecutor)driver;
js.executeScript("arguments[0].click();", drpCompare);
wait.until(ExpectedConditions.visibilityOf(labelRight));

try {
Thread.sleep(2000);
} catch (InterruptedException e) {

e.printStackTrace();
}

}

public String getRightPdi(){
// WebDriverWait wait = new WebDriverWait(driver,7);
// wait.until(ExpectedConditions.visibilityOf(rightPDI));
return rightPDI.getText().replace(" ", "");
}

public String getLeftPdi(){
// WebDriverWait wait = new WebDriverWait(driver,7);
// wait.until(ExpectedConditions.visibilityOf(leftPDI));
return leftPDI.getText().replace(" ", "");
}


public String getLabelLeft() {
// WebDriverWait wait = new WebDriverWait(driver,10);
// wait.until(ExpectedConditions.visibilityOf(labelLeft));
return labelLeft.getText();
}

public String getLabelRight() {
return labelRight.getText();
}

public void scrollPdi() throws InterruptedException{
System.out.println(accVendorLeft.getLocation());


JavascriptExecutor js = (JavascriptExecutor) driver;
// js.executeScript("arguments[0].scrollIntoView(true);", accVendorLeft);
Thread.sleep(5000);
js.executeScript("scroll(0, 1000)");
Thread.sleep(5000);
driver.findElement(By.xpath("//label[@for = 'ACC_vendorInfo_ewv_1']")).click();
System.out.println(accVendorLeft.getLocation());

//boolean result = (accVendorLeft1.getLocation().getY() == accVendorRight1.getLocation().getY());

}


}