When calling the following JS script to open a new tab, it throws a circular reference error:
org.graalvm.polyglot.PolyglotException: javascript failed twice: {"value":{"error":"javascript error","message":"javascript error: circular referencen (Session info: chrome=128.0.6613.119)","stacktrace":"0 chromedriver 0x00000001024af9a8 cxxbridge1$str$ptr + 1887096n1 chromedriver 0x00000001024a7e10 cxxbridge1$str$ptr + 1855456n2 chromedriver 0x00000001020acbe0 cxxbridge1$string$len + 89508n3 chromedriver 0x00000001020b1c90 cxxbridge1$string$len + 110164n4 chromedriver 0x00000001020b3680 cxxbridge1$string$len + 116804n5 chromedriver 0x000000010212b0cc cxxbridge1$string$len + 606864n6 chromedriver 0x000000010212a4a4 cxxbridge1$string$len + 603752n7 chromedriver 0x00000001020e5a08 cxxbridge1$string$len + 322508n8 chromedriver 0x00000001020e666c cxxbridge1$string$len + 325680n9 chromedriver 0x0000000102476068 cxxbridge1$str$ptr + 1651256n10 chromedriver 0x000000010247a99c cxxbridge1$str$ptr + 1669996n11 chromedriver 0x000000010245b1fc cxxbridge1$str$ptr + 1541068n12 chromedriver 0x000000010247b26c cxxbridge1$str$ptr + 1672252n13 chromedriver 0x000000010244c810 cxxbridge1$str$ptr + 1481184n14 chromedriver 0x0000000102499108 cxxbridge1$str$ptr + 1794776n15 chromedriver 0x0000000102499284 cxxbridge1$str$ptr + 1795156n16 chromedriver 0x00000001024a7aac cxxbridge1$str$ptr + 1854588n17 libsystem_pthread.dylib 0x0000000197ab9f94 _pthread_start + 136n18 libsystem_pthread.dylib 0x0000000197ab4d34 thread_start + 8n"}}
- com.intuit.karate.driver.WebDriver.eval(WebDriver.java:160)
- com.intuit.karate.driver.WebDriver.eval(WebDriver.java:167)
- com.intuit.karate.driver.WebDriver.script(WebDriver.java:489)
- <js>.:anonymous(Unnamed:1)
Here is the statement in the Karate feature file to do a basic new tab using JS and switch to it:
* script("window.open('', '_blank');")
And switchPage(1)
I think the first argument cannot be empty. Try this:
* script("window.open('about:blank', '_blank')")
Based on an answer here: /a/66813293/143475
2