mirror of
https://github.com/MontFerret/ferret.git
synced 2025-07-03 00:46:51 +02:00
Feature/#220 iframe support (#315)
* Refactored Virtual DOM structure * Added new E2E tests * Updated E2E Test Runner
This commit is contained in:
@ -2,15 +2,17 @@ package html
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/MontFerret/ferret/pkg/drivers"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values"
|
||||
"github.com/MontFerret/ferret/pkg/runtime/values/types"
|
||||
)
|
||||
|
||||
// Navigate navigates a document to a new resource.
|
||||
// Navigate navigates a given page to a new resource.
|
||||
// The operation blocks the execution until the page gets loaded.
|
||||
// Which means there is no need in WAIT_NAVIGATION function.
|
||||
// @param doc (Document) - Target document.
|
||||
// @param page (HTMLPage) - Target page.
|
||||
// @param url (String) - Target url to navigate.
|
||||
// @param timeout (Int, optional) - Optional timeout. Default is 5000.
|
||||
func Navigate(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
@ -20,7 +22,7 @@ func Navigate(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
return values.None, err
|
||||
}
|
||||
|
||||
doc, err := toDocument(args[0])
|
||||
page, err := drivers.ToPage(args[0])
|
||||
|
||||
if err != nil {
|
||||
return values.None, err
|
||||
@ -47,5 +49,5 @@ func Navigate(ctx context.Context, args ...core.Value) (core.Value, error) {
|
||||
ctx, fn := waitTimeout(ctx, timeout)
|
||||
defer fn()
|
||||
|
||||
return values.None, doc.Navigate(ctx, args[1].(values.String))
|
||||
return values.None, page.Navigate(ctx, args[1].(values.String))
|
||||
}
|
||||
|
Reference in New Issue
Block a user