Error when `switch_to.parent_frame` in PhantomJS and Safari
See original GitHub issueExpected Behavior -
switch_to.parent_frame should switch to parent frame context
Actual Behavior -
#<Selenium::WebDriver::Error::WebDriverError: unexpected response, code=405, content-type="text/plain"
Invalid Command Method - {"headers":{"Accept":"application/json","Accept-Encoding":"gzip;q=1.0,deflate;q=0.6,identity;q=0.3","Connection":"close","Content-Length":"2","Content-Type":"application/x-www-form-urlencoded","Host":"127.0.0.1:8910","User-Agent":"Ruby"},"httpVersion":"1.1","method":"POST","post":"{}","postRaw":"{}","url":"/frame/parent","urlParsed":{"anchor":"","query":"","file":"parent","directory":"/frame/","path":"/frame/parent","relative":"/frame/parent","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/frame/parent","queryKey":{},"chunks":["frame","parent"]},"urlOriginal":"/session/ffde7330-e150-11e5-93a8-5ded1f31d492/frame/parent"}>
Steps to reproduce -
@page.find_elements(:tag_name, "iframe").each do |iframe|
@page.switch_to.frame(iframe)
# eval some JS here
@page.switch_to.parent_frame
rescue => e
# error caught here
@page.switch_to.default_content
end
Using selenium-webdriver ruby gem. Issue manifests under versions 2.52.0 and 2.46.2 (I was originally running 2.46.2, upgraded to 2.52.0 to try and resolve issue but still occurring)
Error occurs on PhantomJS 2.1.1. No errors with Firefox or Chrome. However Safari (latest driver: 2.48) reports a similar error:
#<Selenium::WebDriver::Error::UnknownError: Unknown command: switchToParentFrame>
FWIW, I get the exact same errors for PhantomJS/Safari when running under watir-webdriver 0.8.0, while watir+Firefox and watir+Chrome work fine.
On the other hand, Capybara works just fine on PhantomJS and Safari.
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
not able to switch to iframe using phantomjs - Stack Overflow
Tried switching to frame using various locators such as index , id/name , webelement, no error encountered but objects of page are not...
Read more >SafariDriver fails to switch to frames/iframes? Not currently ...
The below change in switching to iframe in Safari worked perfectly for me. driver.switchTo().frame(driver.findElement(By.id("frame_name")) ...
Read more >Changes - Selenium
switchTo ().parentFrame(). When a named cookie is requested, attempt to fetch it directly using the W3C endpoint, GET /session/{session id}/cookie/{name} .
Read more >Selenium WebDriver Commands | Pragmatic Test Labs
This may result in memory leak errors. ... You will have to switch to the parent frame if you would like to work...
Read more >Agouti - Go Packages
Our PhantomJS integration test is a great place to see everything in action. Expand ▾ ... func (p *Page) SwitchToWindow(name string) error ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having the same problem on Safari. I have an iframe, when I go to my parentFrame, I got:
switchTo defaultContent? then switch back down the frameset?