I have a webpage where Order generated gets displayed in list. I have constraint for the Order details section which has the newly generated Order ID and verify for the Order date and Order status.
<div class="section order-item">
<div class="title">
<strong> Order Number: 1772269 </strong>
</div>
<ul class="info">
<li>Order status: Pending</li>
<li>Order Date: 8/16/2024 1:52:45 AM</li>
<li>Order Total: 807.00</li>
</ul>
</div>
In the above html tree, I need to constraint the section order-item which has order number 1772269 and then check for the order status as Pending and Order date as current date. Note, Order number gets generated during runtime.
Using driver.findElement() function, I am able to pass the Order number dynamically during runtime and validate for Order Number.
WebElement orderNumber = driver.findElement(By.xpath("//div[@class='section order-item']//div[@class='title']//strong[contains(text(),'"+orderNum+"')]"));
Query 1: How to implement this in PageFactory model. Because, in page factory model if I give the same format it is not accepting the dynamic value.
@FindBy(xpath="//div[@class='section order-item']//div[@class='title']//strong[contains(text(),'Order Number: "+orderNum+"')]") WebElement orderNumber;
Query 2: I am able to traverse until OrderNumber using Xpath
//div[@class='section order-item']//div[@class='title']//strong[contains(text(),'Order Number: 1772269')]
But how to reach orderStatus and Order date. If I try to enter
//div[@class='section order-item']//div[@class='title']//strong[contains(text(),'Order Number: 1772269')]//ul
it is not reaching the path.