Witam, chciałbym dodać do mojego kodu kolejny element do znalezienia i kliknięcia.
Na początku kiedy to zrobiłem i odpaliłem, wszystko działało jak powinno. Lecz kiedy dodałem do kodu aby otworzyła się kolejna strona, program zatrzymał się na 1 elemencie wyszukiwania i kliknięcia. Po usunięciu z kodu odpalenia nowej strony, problem nadal występuje.
Mój kod( bez
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class bot12 {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\macie\\eclipse-workspace\\bot v12\\lib\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.navigate().to("https://www.supremenewyork.com/shop/all/sweatshirts/");
driver.findElement(By.partialLinkText("Jewels Hooded Sweatshirt")).click();
driver.findElement(By.name("commit")).click();
driver.navigate().to("https://www.supremenewyork.com/checkout/");
}
}
Dodatkowo w konsoli wyskakuje takie coś:
*** Element info: {Using=name, value=commit}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:160)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:371)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByName(RemoteWebDriver.java:449)
at org.openqa.selenium.By$ByName.findElement(By.java:303)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at bot12.main(bot12.java:11)