I've been using selenium to autofill credit card information for certain websites. I use ChromeDriver and it had been working fine, but yesterday it seems like the website I had been using blocked this feature (At least I think). Here is the code I've been using. As you'll see in the code, I also tested it with FireFox and it worked just fine, so I thought it could be a ChromeDriver issue, but I've tried different versions and they all seem to have this problem on this specific website. I tried using it on google and searching something and it worked just fine with the ChromeDriver.
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Name\\Desktop\\WebStuff\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.setHeadless(false);
//FirefoxOptions options = new FirefoxOptions();
//options.setHeadless(false);
WebDriver driver = new ChromeDriver(options);
driver.get("http://www.supremenewyork.com/shop/accessories/z1fwxyqis");
WebElement cart = driver.findElement(By.cssSelector("input.button"));
cart.submit();
Thread.sleep(1000);
driver.get("http://www.supremenewyork.com/checkout");
Thread.sleep(500);
System.out.println("About to hit billing");
WebElement name = driver.findElement(By.id("order_billing_name"));
name.sendKeys("testing name");
}
Here is also the error I get in console
Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'.
(Session info: chrome=65.0.3325.181)
(Driver info: chromedriver=2.37.544315 (730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform=Windows NT 10.0.16299 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:08.638Z'
System info: host: 'DESKTOP-DOHH590', ip: '192.168.1.132', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_161'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.37.544315 (730aa6a5fdba15..., userDataDir: C:\Users\Shayan\AppData\Loc...}, cssSelectorsEnabled: true, databaseEnabled: false, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 65.0.3325.181, webStorageEnabled: true}
Session ID: 26e9dd507ff523a3444484b7fedb8793
*** Element info: {Using=id, value=order_billing_name}
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:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:545)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:319)
at org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:365)
at org.openqa.selenium.By$ById.findElement(By.java:218)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:311)
at me.iran.testing.Main.main(Main.java:39)
Java
, changed the url to: supremenewyork.com/shop/shirts/byl5txdhj. Whatever was the original problem it cannot be reproduced anymore, as the link got changed and running the code with a different link works.