-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
added frame code #2236
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
added frame code #2236
Changes from all commits
e22d14d
1d7e3e8
5ebb044
5744883
76cc800
0626f8c
b1f57d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,5 +3,40 @@ | |||||
require 'spec_helper' | ||||||
|
||||||
RSpec.describe 'Frames' do | ||||||
#set session | ||||||
let(:driver) { start_session } | ||||||
let(:wait) { Selenium::WebDriver::Wait.new(timeout: 2) } | ||||||
|
||||||
it 'interacts with elements inside iframes' do | ||||||
#navigate to web page | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code comments might trip up IDE's as generally they have one space infront of the |
||||||
driver.navigate.to 'https://www.selenium.dev/selenium/web/iframes.html' | ||||||
# Switch to iframe using WebElement | ||||||
iframe = driver.find_element(id: 'iframe1') | ||||||
driver.switch_to.frame(iframe) | ||||||
expect(driver.page_source.include?('We Leave From Here')).to be true | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Reason. RSpec exposes these booleans and it's a way of getting a better error message if it occurs |
||||||
|
||||||
# Interact with email field | ||||||
email_element = driver.find_element(id: 'email') | ||||||
email_element.send_keys('admin@selenium.dev') | ||||||
email_element.clear | ||||||
driver.switch_to.default_content | ||||||
|
||||||
# Switch to iframe using name | ||||||
iframe=driver.find_element(name: 'iframe1-name') | ||||||
driver.switch_to.frame(iframe) | ||||||
expect(driver.page_source.include?('We Leave From Here')).to be true | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
email = driver.find_element(id: 'email') | ||||||
email.send_keys('admin@selenium.dev') | ||||||
email.clear | ||||||
driver.switch_to.default_content | ||||||
|
||||||
# Switch to iframe using index | ||||||
driver.switch_to.frame(0) | ||||||
expect(driver.page_source.include?('We Leave From Here')).to be true | ||||||
|
||||||
# Leave frame | ||||||
driver.switch_to.default_content | ||||||
expect(driver.page_source.include?('This page has iframes')).to be true | ||||||
end | ||||||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Traditionally exact versions can be provided just by doing
'0.134.0'
(Same below)