Hello, I am a beginner with selenium webdriver and I am trying to compare two items on any certain website, such as
newegg.com.
//Clicking and comparing two items
WebElement compare1 = driver.findElement(By.xpath("//span[@class='form-checkbox']"));
WebElement compare2 = driver.findElement(By.xpath("//span[@class='form-checkbox']"));
compare1.click();
Thread.sleep(2000);
compare2.click();
Thread.sleep(2000);
This is part of my current code to compare the two items. I have tried by.className, but it couldn't get more than one. I have also tried using xpath like //input[1] and //input[2] and so on, but still not able to get anything.
If I use the current code, it will only select the first item and only one item.
I was wondering if I could get some help on being able to select another item to compare it.
Attached is newegg's source code for the example I'm using.
Any pointers, tips, anything would be great to have.
Thanks