sourcegraph / go-selenium

Selenium WebDriver client for Go
https://sourcegraph.com/github.com/sourcegraph/go-selenium
Other
367 stars 73 forks source link

How to switch to frame via WebElement? #21

Closed ghost closed 7 years ago

ghost commented 8 years ago

There is only one function:

/* Switch to frame, frame parameter can be name or id. */
SwitchFrame(frame string) error

But how can I switch to frame if this frame do not have id and name attributes? For example in Python there is a method that take WebElement as a parameter, looks like:

frame = driver.find_element_by_css_selector("#main iframe")
driver.switch_to.frame(frame)

I don't know JsonWireProtocol, maybe it is possible to do it via WebElement? Otherwise I can solve this problem via a hack: 1) find frame tag 2) add to this tag a uniq id attribute 3) do SwitchFrame via id