Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've just check out <a href="https://github.com/SeleniumHQ/fluent-selenium" rel="nofollow">Fluent Selenium</a> which uses Firefox WebDriver. It's a testing framework, so don't be surprised by presence of asserting methods. It can be used for crawling. Worked perfectly for me with very little configuration. It requires Maven to run, here is my working example:</p> <pre><code>package fluent; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.seleniumhq.selenium.fluent.FluentWebDriver; import org.seleniumhq.selenium.fluent.Period; import org.seleniumhq.selenium.fluent.TestableString; import java.util.concurrent.TimeUnit; import static org.openqa.selenium.By.className; public class Test { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); FluentWebDriver fwd = new FluentWebDriver(driver); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); driver.get("http://www.hudku.com/search/business-list/Paint%20%26%20Hardware%20in%20Kanakapura%20Road,%20Bangalore,%20Karnataka,%20India?p=6&amp;h1=mgK%3DFsPlSAsPTaOVwo%2F0FIMA"); driver.navigate(); TestableString test = fwd.div(className("heading")).within(Period.secs(3)).getText(); System.out.println("header: " + test.toString()); test.shouldContain("Paint"); System.out.println("all is fine!"); } } </code></pre> <p>My <code>pom.xml</code>:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;testPrj3&lt;/groupId&gt; &lt;artifactId&gt;testPrj3&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.seleniumhq.selenium.fluent&lt;/groupId&gt; &lt;artifactId&gt;fluent-selenium&lt;/artifactId&gt; &lt;version&gt;1.14.2&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.hamcrest&lt;/groupId&gt; &lt;artifactId&gt;hamcrest-all&lt;/artifactId&gt; &lt;version&gt;1.3&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;/dependency&gt; &lt;!-- If you're needing Coda Hale's Metrics integration (optional) --&gt; &lt;dependency&gt; &lt;groupId&gt;com.codahale.metrics&lt;/groupId&gt; &lt;artifactId&gt;metrics-core&lt;/artifactId&gt; &lt;version&gt;3.0.0&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;3.1&lt;/version&gt; &lt;configuration&gt; &lt;source&gt;1.7&lt;/source&gt; &lt;target&gt;1.7&lt;/target&gt; &lt;/configuration&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;/project&gt; </code></pre> <p><strong>UPDATE</strong></p> <p><a href="https://github.com/FluentLenium/FluentLenium" rel="nofollow">FluentLenium</a> seems being a little more popular.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload