Reputation: 1068
I am trying to create an automation programm for a site using ui4j, but i got to a halt. Had use UI4J in the past and worked like a charm, but now it cant not find the item i need it to click on to move to an other page. the code from the website is this
<div>
<a id="T:df6yt:0:jfcx6" class="x1sq xfd" href="#" onclick="return false;" title="Αναζήτηση"></a>
</div>
I use this on my java program
BrowserEngine webkit = BrowserFactory.getWebKit();
Page page = webkit.navigate("http://www.eprocurement.gov.gr");
page.show();
Document document = page.getDocument();
Thread.sleep(30000);
document.query("T:df6yt:0:jfcx6").click();
which gives me this error
Exception in thread "JavaFX Application Thread" com.ui4j.api.util.Ui4jException: org.w3c.dom.DOMException
at com.ui4j.webkit.proxy.WebKitProxy$CallableExecutor.run(WebKitProxy.java:46)
at com.sun.javafx.application.PlatformImpl.lambda$null$170(PlatformImpl.java:295)
at com.sun.javafx.application.PlatformImpl$$Lambda$55/1876181116.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$171(PlatformImpl.java:294)
at com.sun.javafx.application.PlatformImpl$$Lambda$53/1995813168.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$48(GtkApplication.java:139)
at com.sun.glass.ui.gtk.GtkApplication$$Lambda$43/345577659.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.w3c.dom.DOMException
at com.sun.webkit.dom.DocumentImpl.querySelectorImpl(Native Method)
at com.sun.webkit.dom.DocumentImpl.querySelector(DocumentImpl.java:1102)
at com.ui4j.webkit.spi.W3CSelectorEngine.query(W3CSelectorEngine.java:41)
at com.ui4j.webkit.dom.WebKitDocument.query(WebKitDocument.java:42)
at com.ui4j.webkit.dom.WebKitDocument$ByteBuddy$rFtzsPLl.query$accessor$fcVUXi0a(Unknown Source)
at com.ui4j.webkit.dom.WebKitDocument$ByteBuddy$rFtzsPLl$accessor$K6O5cVza.call(Unknown Source)
at com.ui4j.webkit.proxy.WebKitProxy$CallableExecutor.run(WebKitProxy.java:44)
... 10 more
any help?
Upvotes: -1
Views: 722
Reputation:
T:df6yt:0:jfcx6 is not a valid selector. Colon character must be escaped. As alternative solution use this a[title='Αναζήτηση'].x1sq selector.
Upvotes: 0