This WinForm C# .NET project facilitates tracking parts and providing statuses to link the Parts Department and Service Department of a dealership.
It's goal is to provide an accurate shipping Status and ETA directly through Parts Workbench Plus instead of relying on separate software.
The GetETAFromPWB
method is a crucial component of this project. It automates the retrieval of Estimated Time of Arrival (ETA) data for parts from PWB+ (a website) using Chrome WebDriver through Selenium automation. It iterates over a list of parts, navigates through login pages, fetches shipment details, and updates the database with the ETA and status of each part.
This method retrieves Estimated Time of Arrival (ETA) data for parts from PWB+ using Chrome WebDriver through Selenium automation. It navigates through login pages, fetches shipment details, and updates the database with the ETA and status of each part.
worker
: ABackgroundWorker
object used to report progress to the GUI thread.
Void Method (None)
- Clones the list of parts to avoid updating the main part data until complete.
- Iterates through each part in the cloned list.
- Sets up a headless Chrome WebDriver with Selenium for automated browsing.
- Navigates to the login page of
autopartners.net
and logs in with provided credentials. - Navigates to the purchase orders page on PWB+ for the current part.
- Waits for the
controlNumber
element to ensure the page is loaded. - Checks if the shipment exists. If not, continues to the next part.
- Finds and clicks the XMS link to proceed to shipment tracking.
- Navigates to the shipment tracking URL.
- Retrieves the status of the shipment and handles different scenarios.
- Updates the database with the ETA and status of the part.
- Closes the WebDriver connection for the current part.
- Reports progress to the GUI thread using the provided
BackgroundWorker
. - Closes and quits the current ChromeDriver connection and loops until complete.
This method relies on specific HTML structure and may require adjustments if the structure of the target websites changes.
To use this method, ensure you have the necessary dependencies installed, including Chrome WebDriver and Selenium. Then, integrate the GetETAFromPWB
method into your project and provide the required parameters.
Contributions to this project are welcome. If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.