在GEB刮擦中关闭弹出窗口

时间:2014-10-25 02:35:33

标签: web-scraping geb

我想通过GEB在此站点busromani.cl/site/中删除表单,但出现以下错误

org.openqa.selenium.WebDriverException:未知错误:     元素在点(191,238)处不可点击。其他元素将收到点击:     ...

这是因为本网站的弹出窗口。 任何人都可以帮我解决这个问题吗?

这是抓取代码

  def processRoute(def route, def params) {
    def browser = params.browser
    browser.drive {

        log.info "Processing route ${route.routeName}"
        go "http://www.busesromani.cl/site/"

        def startCity = route.startLocation
        def endCity = route.endlocation
        waitFor(20) { $("div form#form").verifyNotEmpty() }
        def idaRadio = $("#si")
        idaRadio.verifyNotEmpty()
        idaRadio.click()
        def origin = $("#origen")
        origin.verifyNotEmpty()
        try {
            origin.value(startCity)
            log.info "Set origin to $startCity"
        } catch (Exception e) {
            log.error "Error setting origin: ${startCity}" + e
            return
        }

        def datefield = $("#Partida")
        datefield.verifyNotEmpty()

        def date = params.date
        log.info "Got the Date field, setting date to $date"

        js.exec("window.document.getElementById('cal-field-1').value='$date';")
        log.info "Ran the javascript to set date"
        def destination = $("#destino")

        destination.verifyNotEmpty()
        try {
            destination.value(endCity)
            log.info "Set destination to $endCity"
        } catch (Exception e) {
            log.info "Error setting destination: ${endCity}" + e
            return
        }

        def button = $("input.btn fl-right")
        button.verifyNotEmpty()
        button.click()

    } // browser
 }

0 个答案:

没有答案