diff --git a/examples/ruby/spec/interactions/cookies_spec.rb b/examples/ruby/spec/interactions/cookies_spec.rb index b679a720ba20..d649ddfb4d54 100644 --- a/examples/ruby/spec/interactions/cookies_spec.rb +++ b/examples/ruby/spec/interactions/cookies_spec.rb @@ -1,3 +1,5 @@ + + # frozen_string_literal: true require 'spec_helper' diff --git a/examples/ruby/spec/interactions/frames_spec.rb b/examples/ruby/spec/interactions/frames_spec.rb index d7b27b174044..d8b3b0c3b3dc 100644 --- a/examples/ruby/spec/interactions/frames_spec.rb +++ b/examples/ruby/spec/interactions/frames_spec.rb @@ -1,7 +1,52 @@ +# Licensed to the Software Freedom Conservancy (SFC) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The SFC licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. # frozen_string_literal: true require 'spec_helper' RSpec.describe 'Frames' do let(:driver) { start_session } + + it 'performs iframe switching operations' do + 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).to include('We Leave From Here') + + 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 or ID --- + iframe1 = driver.find_element(:name, 'iframe1-name') + driver.switch_to.frame(iframe1) + expect(driver.page_source).to include('We Leave From Here') + + 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).to include('We Leave From Here') + # --- Final page content check --- + driver.switch_to.default_content + expect(driver.page_source).to include('This page has iframes') + end end diff --git a/website_and_docs/content/documentation/webdriver/interactions/frames.en.md b/website_and_docs/content/documentation/webdriver/interactions/frames.en.md index fa53e01d43c4..aecc6389be15 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/frames.en.md +++ b/website_and_docs/content/documentation/webdriver/interactions/frames.en.md @@ -84,16 +84,13 @@ find the frame using your preferred selector and switch to it. {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L38-L46" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Store iframe web element -iframe = driver.find_element(:css,'#modal > iframe') + + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L26-L33" >}} +{{< /tab >}} - # Switch to the frame -driver.switch_to.frame iframe - # Now, Click on the button -driver.find_element(:tag_name,'button').click - {{< /tab >}} {{< tab header="JavaScript" >}} // Store the web element const iframe = driver.findElement(By.css('#modal > iframe')); @@ -134,13 +131,12 @@ one found will be switched to. {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L50-L58" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Switch by ID -driver.switch_to.frame 'buttonframe' + + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L36-L43" >}} +{{< /tab >}} - # Now, Click on the button -driver.find_element(:tag_name,'button').click - {{< /tab >}} {{< tab header="JavaScript" >}} // Using the ID await driver.switchTo().frame('buttonframe'); @@ -179,13 +175,20 @@ queried using _window.frames_ in JavaScript. {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L45-L46" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Switch to the second frame -driver.switch_to.frame(1) - {{< /tab >}} + + + {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L62-L63" >}} {{< /tab >}} + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L46-L47" >}} +{{< /tab >}} + + + + {{< tab header="JavaScript" >}} // Switches to the second frame await driver.switchTo().frame(1); @@ -216,10 +219,12 @@ like so: {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L66-L67" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Return to the top level -driver.switch_to.default_content - {{< /tab >}} + + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L49-L50" >}} +{{< /tab >}} + {{< tab header="JavaScript" >}} // Return to the top level await driver.switchTo().defaultContent(); diff --git a/website_and_docs/content/documentation/webdriver/interactions/frames.ja.md b/website_and_docs/content/documentation/webdriver/interactions/frames.ja.md index 57281cdbd6a5..4c951e88f8a2 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/frames.ja.md +++ b/website_and_docs/content/documentation/webdriver/interactions/frames.ja.md @@ -71,16 +71,14 @@ WebElementを使用した切り替えは、最も柔軟なオプションです {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L38-L46" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Store iframe web element -iframe = driver.find_element(:css,'#modal > iframe') + + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L26-L36" >}} +{{< /tab >}} + - # Switch to the frame -driver.switch_to.frame iframe - # Now, Click on the button -driver.find_element(:tag_name,'button').click - {{< /tab >}} {{< tab header="JavaScript" >}} // Store the web element const iframe = driver.findElement(By.css('#modal > iframe')); @@ -120,6 +118,13 @@ FrameまたはiFrameにidまたはname属性がある場合、代わりにこれ {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L50-L58" >}} {{< /tab >}} + + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L36-L43" >}} +{{< /tab >}} + + {{< tab header="JavaScript" >}} // Using the ID await driver.switchTo().frame('buttonframe'); @@ -130,6 +135,8 @@ await driver.switchTo().frame('myframe'); // Now we can click the button await driver.findElement(By.css('button')).click(); {{< /tab >}} + + {{< tab header="Kotlin" >}} //Using the ID driver.switchTo().frame("buttonframe") @@ -153,13 +160,15 @@ JavaScriptの _window.frames_ を使用して照会できるように、Frameの {{< tab header="Python" text=true >}} {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L45-L46" >}} {{< /tab >}} -{{< tab header="Ruby" >}} -# Switch to the second frame -driver.switch_to.frame(1) -{{< /tab >}} +{ {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L62-L63" >}} {{< /tab >}} + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L46-L47" >}} +{{< /tab >}} + {{< tab header="JavaScript" >}} // Switches to the second frame await driver.switchTo().frame(1); @@ -186,10 +195,11 @@ driver.switch_to.default_content() {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L66-L67" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Return to the top level -driver.switch_to.default_content - {{< /tab >}} + + {{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L49-L50" >}} +{{< /tab >}} + {{< tab header="JavaScript" >}} // Return to the top level await driver.switchTo().defaultContent(); diff --git a/website_and_docs/content/documentation/webdriver/interactions/frames.pt-br.md b/website_and_docs/content/documentation/webdriver/interactions/frames.pt-br.md index eda4f364ffb4..8e6187c61564 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/frames.pt-br.md +++ b/website_and_docs/content/documentation/webdriver/interactions/frames.pt-br.md @@ -78,16 +78,12 @@ encontrar o quadro usando seu seletor preferido e mudar para ele. {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L38-L46" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Store iframe web element -iframe = driver.find_element(:css,'#modal > iframe') + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L26-L33" >}} +{{< /tab >}} - # Switch to the frame -driver.switch_to.frame iframe - # Now, Click on the button -driver.find_element(:tag_name,'button').click - {{< /tab >}} {{< tab header="JavaScript" >}} // Store the web element const iframe = driver.findElement(By.css('#modal > iframe')); @@ -127,13 +123,14 @@ primeiro encontrado será utilizado. {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L50-L58" >}} {{< /tab >}} - {{< tab header="Ruby" >}} - # Switch by ID -driver.switch_to.frame 'buttonframe' + + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L36-L43" >}} +{{< /tab >}} + + - # Now, Click on the button -driver.find_element(:tag_name,'button').click - {{< /tab >}} {{< tab header="JavaScript" >}} // Using the ID await driver.switchTo().frame('buttonframe'); @@ -168,13 +165,16 @@ consultado usando _window.frames_ em JavaScript. {{< tab header="Python" text=true >}} {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L45-L46" >}} {{< /tab >}} -{{< tab header="Ruby" >}} -# Switch to the second frame -driver.switch_to.frame(1) -{{< /tab >}} + {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L62-L63" >}} {{< /tab >}} + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L46-L47" >}} +{{< /tab >}} + + {{< tab header="JavaScript" >}} // Switches to the second frame await driver.switchTo().frame(1); @@ -201,10 +201,12 @@ como a seguir: {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L66-L67" >}} {{< /tab >}} -{{< tab header="Ruby" >}} -# Return to the top level -driver.switch_to.default_content + + {{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L49-L50" >}} {{< /tab >}} + + {{< tab header="JavaScript" >}} // Return to the top level await driver.switchTo().defaultContent(); diff --git a/website_and_docs/content/documentation/webdriver/interactions/frames.zh-cn.md b/website_and_docs/content/documentation/webdriver/interactions/frames.zh-cn.md index 96dba4e38f4a..79225e6922cf 100644 --- a/website_and_docs/content/documentation/webdriver/interactions/frames.zh-cn.md +++ b/website_and_docs/content/documentation/webdriver/interactions/frames.zh-cn.md @@ -72,16 +72,12 @@ driver.findElement(By.tagName("button")).click() {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L38-L46" >}} {{< /tab >}} -{{< tab header="Ruby" >}} - # Store iframe web element -iframe = driver.find_element(:css,'#modal> iframe') - - # 切换到 frame -driver.switch_to.frame iframe - # 单击按钮 -driver.find_element(:tag_name,'button').click +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L26-L33" >}} {{< /tab >}} + + {{< tab header="JavaScript" >}} // 存储网页元素 const iframe = driver.findElement(By.css('#modal> iframe')); @@ -121,13 +117,13 @@ driver.findElement(By.tagName("button")).click() {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L50-L58" >}} {{< /tab >}} -{{< tab header="Ruby" >}} - # Switch by ID -driver.switch_to.frame 'buttonframe' - # 单击按钮 -driver.find_element(:tag_name,'button').click + +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L36-L43" >}} {{< /tab >}} + + {{< tab header="JavaScript" >}} // 使用 ID await driver.switchTo().frame('buttonframe'); @@ -165,15 +161,16 @@ _window.frames_ 进行查询. {{< gh-codeblock path="examples/python/tests/interactions/test_frames.py#L45-L46" >}} {{< /tab >}} -{{< tab header="Ruby" >}} - # 切换到第 2 个框架 -driver.switch_to.frame(1) -{{< /tab >}} + {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L62-L63" >}} {{< /tab >}} +{{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L46-L47" >}} +{{< /tab >}} + {{< tab header="JavaScript" >}} // 切换到第 2 个框架 await driver.switchTo().frame(1); @@ -199,10 +196,12 @@ driver.switchTo().frame(1) {{< tab header="CSharp" text=true >}} {{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/FramesTest.cs#L66-L67" >}} {{< /tab >}} -{{< tab header="Ruby" >}} - # 回到顶层 -driver.switch_to.default_content + + {{< tab header="Ruby" text=true >}} +{{< gh-codeblock path="examples/ruby/spec/interactions/frames_spec.cs#L49-L50" >}} {{< /tab >}} + + {{< tab header="JavaScript" >}} // 回到顶层 await driver.switchTo().defaultContent(); diff --git a/website_and_docs/package-lock.json b/website_and_docs/package-lock.json index bdc2337e3144..ff1546a8f3ee 100644 --- a/website_and_docs/package-lock.json +++ b/website_and_docs/package-lock.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "autoprefixer": "^10.4.21", - "postcss": "^8.5.3", + "postcss": "^8.5.4", "postcss-cli": "^11.0.1" } }, @@ -466,6 +466,7 @@ "url": "https://github.com/sponsors/ai" } ], + "license": "MIT", "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", diff --git a/website_and_docs/package.json b/website_and_docs/package.json index 81bde38ea5b8..86efb58fae8b 100644 --- a/website_and_docs/package.json +++ b/website_and_docs/package.json @@ -10,7 +10,7 @@ "license": "Apache-2.0", "dependencies": { "autoprefixer": "^10.4.21", - "postcss": "^8.5.3", + "postcss": "^8.5.4", "postcss-cli": "^11.0.1" } }