如何使用Selenium处理画布?

时间:2018-04-12 03:17:18

标签: selenium canvas

我尝试使用Selenium测试此网站https://classpad.net/classpad/use-as-guest。我不知道如何使表单选择可见。请参阅下面的图片了解更多详情。

[在我点击空白区域之前]

[点击后]

    import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
//import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class DriverScript {
    public static WebDriver driver;
    public static WebElement element;

    public static void main(String[] args) {
        driver = new FirefoxDriver();

        driver.navigate().to("http://34.201.210.27/classpad");
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.manage().window().maximize();

        driver.findElement(By.xpath("/html/body/div/div[2]/form/a[2]")).click();

        WebDriverWait wait = new WebDriverWait(driver, 20);
        wait.until(ExpectedConditions.presenceOfElementLocated(By.className("scratchpaper-detail")));

        JavascriptExecutor js=(JavascriptExecutor)driver;
        js.executeScript("$('.scratchpaper-detail .stickyContainer .inputForm').show()");


        String element = driver.getTitle();

        System.out.println(element);

    }


}

0 个答案:

没有答案