调用以下JS脚本打开新选项卡时,抛出循环引用错误:
org.graalvm.polyglot.PolyglotException: javascript failed twice: {"value":{"error":"javascript error","message":"javascript error: circular reference\n (Session info: chrome=128.0.6613.119)","stacktrace":"0 chromedriver 0x00000001024af9a8 cxxbridge1$str$ptr + 1887096\n1 chromedriver 0x00000001024a7e10 cxxbridge1$str$ptr + 1855456\n2 chromedriver 0x00000001020acbe0 cxxbridge1$string$len + 89508\n3 chromedriver 0x00000001020b1c90 cxxbridge1$string$len + 110164\n4 chromedriver 0x00000001020b3680 cxxbridge1$string$len + 116804\n5 chromedriver 0x000000010212b0cc cxxbridge1$string$len + 606864\n6 chromedriver 0x000000010212a4a4 cxxbridge1$string$len + 603752\n7 chromedriver 0x00000001020e5a08 cxxbridge1$string$len + 322508\n8 chromedriver 0x00000001020e666c cxxbridge1$string$len + 325680\n9 chromedriver 0x0000000102476068 cxxbridge1$str$ptr + 1651256\n10 chromedriver 0x000000010247a99c cxxbridge1$str$ptr + 1669996\n11 chromedriver 0x000000010245b1fc cxxbridge1$str$ptr + 1541068\n12 chromedriver 0x000000010247b26c cxxbridge1$str$ptr + 1672252\n13 chromedriver 0x000000010244c810 cxxbridge1$str$ptr + 1481184\n14 chromedriver 0x0000000102499108 cxxbridge1$str$ptr + 1794776\n15 chromedriver 0x0000000102499284 cxxbridge1$str$ptr + 1795156\n16 chromedriver 0x00000001024a7aac cxxbridge1$str$ptr + 1854588\n17 libsystem_pthread.dylib 0x0000000197ab9f94 _pthread_start + 136\n18 libsystem_pthread.dylib 0x0000000197ab4d34 thread_start + 8\n"}}
- 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)
以下是空手道功能文件中的语句,用于使用 JS 执行基本的新选项卡并切换到它:
* script("window.open('', '_blank');")
And switchPage(1)
我认为第一个参数不能为空。试试这个:
* script("window.open('about:blank', '_blank')")