File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
examples/ruby/spec/interactions Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 13
13
# KIND, either express or implied. See the License for the
14
14
# specific language governing permissions and limitations
15
15
# under the License.
16
-
17
-
18
16
# frozen_string_literal: true
19
17
20
18
require 'spec_helper'
23
21
let ( :driver ) { start_session }
24
22
25
23
it 'performs iframe switching operations' do
26
- # Set firefox and launch web page
27
- # driver = Selenium::WebDriver.for :firefox
28
- driver . get ( 'https://www.selenium.dev/selenium/web/iframes.html' )
24
+ driver . navigate . to 'https://www.selenium.dev/selenium/web/iframes.html'
29
25
# --- Switch to iframe using WebElement ---
30
26
iframe = driver . find_element ( :id , 'iframe1' )
31
27
driver . switch_to . frame ( iframe )
37
33
driver . switch_to . default_content
38
34
39
35
# --- Switch to iframe using name or ID ---
40
- iframe1 = driver . find_element ( :name , 'iframe1-name' ) # (This line doesn't switch, just locates)
36
+ iframe1 = driver . find_element ( :name , 'iframe1-name' )
41
37
driver . switch_to . frame ( iframe1 )
42
38
expect ( driver . page_source ) . to include ( 'We Leave From Here' )
43
39
53
49
# --- Final page content check ---
54
50
driver . switch_to . default_content
55
51
expect ( driver . page_source ) . to include ( 'This page has iframes' )
56
-
57
- # Quit the driver
58
- driver . quit
59
52
end
60
53
end
You can’t perform that action at this time.
0 commit comments