-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to switch to frame on Selenium 3.x #866
Comments
Implemented in these PRs:
I've also updated relevant DocBlocks to indicate, that frame index can also be specified. Probably the |
Before calling this a bug, let's be clear - it was never defined that we can switch an iframe by index, as can be seen by your update of that comment: I'm fine with supporting this though, just saying that any old usages with integers were misuses. |
@uuf6429 , I'm not saying it's a bug. I'm saying that method signature change has prevented certain (might not be documented) Mink usage scenarios from working. Since method DocBlock always was P.S.
|
Update: with the help of the @uuf6429 , I was able to get frame switching by name working on Selenium 3 (see minkphp/MinkSelenium2Driver#382). |
@stof , I only need a review from you. The merging and build rerunning I can do myself to save your time. Also please look at the minkphp/MinkSelenium2Driver#382. |
I don't think using an integer index was ever meant to be supported in the Mink API. It worked in Selenium2Driver in the past only due to the lack of native parameter types that allowed to ignore the intended method signature. If we were adding support for integer indexes in the Mink API, we would have to specify the meaning of those indexes. And if we say "this is the index in WebDriver Classic", this would not impossible to implement in any driver not based on the WebDriver protocol. As you managed to fix the issue in the Selenium2Driver to actually support names, I suggest closing this issue. |
Agreed. Here are the actions I've performed based on your response: Closed
Repurposed
|
@aik099 if all points have been resolved, please consider closing this issue. Thanks! |
Short story:
After a #856 change (included in Mink 1.11.0 release) the
switchToIFrame
method signature was massively (DriverInterface
,CoreDriver
,Selenium2Driver
, etc.) changed:public function switchToIFrame($name = null)
;public function switchToIFrame(?string $name = null)
.This has broken any code like
$session->switchToIFrame(2);
, because PHP internally casts frame index to string and Selenium gets{"id":"2"}
instead of{"id":2}
in it's/session/:sessionId/frame
command and frame switching fails.P.S.
I'm posting an issue here because it affects both Mink's own, the test suite and driver files.
Possible solution:
\Behat\Mink\Driver\Selenium2Driver::switchToIFrame
method a bit clever and if a given$name
is actually a number, then cast it to an integer (if we still have other frame-aware drivers, then this applies to them as well)switchToIFrame
method signature changes, because$name
can't be declared as both integer and string (in supported PHP versions).In either case, the
\Behat\Mink\Tests\Driver\Basic\IFrameTest::testIFrame
test needs to be improved with index-based frame-switching support.Long story
According to JSON Wire Protocol you can switch frame in these ways (Mink code shown):
$session->switchToIFrame('frame_name');
- by frame name$session->switchToIFrame(2);
- by frame indexIn real-life tests, however, the results are the following:
// cc: @stof
Updates:
The text was updated successfully, but these errors were encountered: