I'm trying to compare two different tables using the method called VerifyOrderSummary
located at the end of the main
method below.
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.gecko.driver", "geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
Item testItem = Item.WRENCH;
driver.get("http://test.url/WebOrderScreen");
AddItem(testItem);
ChangeItemQuantity(testItem, 3);
WebElement shoppingCartListContents = driver.findElement(By.id("shopping-cart")).findElement(By.xpath(".//tbody[@class='nx-list-contents']"));
List<WebElement> shoppingCartRows = shoppingCartListContents.findElements(By.tagName("tr"));
System.out.println(shoppingCartRows.size());
System.out.println(shoppingCartRows.get(0).getText());
ClickWorkflowButton(Button.PAYMENTINFORMATION);
WebElement orderSummaryListContents = driver.findElement(By.id("order-summary")).findElement(By.xpath(".//tbody[@class='nx-list-contents']"));
List<WebElement> orderSummaryRows = orderSummaryListContents.findElements(By.tagName("tr"));
VerifyOrderSummary(shoppingCartRows, orderSummaryRows);
}
The issue i am seeing is that when i print out the first row of shoppingRowCartsRows
in the main method, it prints out correctly.
but within the VerifyOrderSummary method, it prints out a blank line:
public static void VerifyOrderSummary(List<WebElement> shoppingCartRows, List<WebElement> orderSummaryRows) {
//given the shopping cart rows and order summary rows, compare the two
for(int i = 0; i < shoppingCartRows.size(); i++) {
System.out.println("shopping cart row: "+shoppingCartRows.get(i).getText());
System.out.println("order summary row: "+orderSummaryRows.get(i).getText());
// Assert.assertEquals(shoppingCartRows.get(i).getText(), orderSummaryRows.get(i).getText());
//System.out.println(models.get(i).getName());
}
Can anyone tell me why that is happening? I'm completely lost at the moment.