package HaviskarProject;
import static [Link].*;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import static [Link];
public class GoogleSearchTest {
private WebDriver driver;
private WebDriverWait wait;
@BeforeEach
public void setUp() {
// Set the path to the ChromeDriver executable
[Link]("[Link]", "C:\\Users\\Admin\\Downloads\\selenium
files\\chromedriver-win64\\[Link]");
// Initialize the WebDriver
driver = new ChromeDriver();
// Initialize the WebDriverWait with a 10 seconds timeout
wait = new WebDriverWait(driver, [Link](10));
// Print message to console
[Link]("Browser opened and WebDriver initialized.");
@AfterEach
//public void tearDown() {
// if (driver != null) {
// [Link]();
// Print message to console
// [Link]("Browser closed and WebDriver quit.");
// }
// }
@Test
public void testGoogleSearch() {
// Open Google
[Link]("[Link]
[Link]("Navigated to Google homepage.");
// Wait for the search box to be visible
WebElement searchBox =
[Link]([Link]([Link]("q")));
[Link]("Search box located.");
// Enter search query into the search box
[Link]("Ubuntu 22.04 LTS");
[Link]("Search query 'Ubuntu 22.04 LTS' entered.");
// Submit the search
[Link]();
[Link]("Search submitted.");
// Wait for the title to contain the search term
[Link]([Link]("Ubuntu 22.04 LTS"));
[Link]("Title contains 'Ubuntu 22.04 LTS'.");
// Assert that the title contains the search term
assertTrue([Link]().contains("Ubuntu 22.04 LTS"));
[Link]("Test passed: Title contains 'Ubuntu 22.04 LTS'.");