Skip to content

Commit 5ee5132

Browse files
harsha509diemol
authored andcommitted
Updated python and ruby code for browser manipulation (#368)
* [docs]: Updated ruby sample code for browser manipulation Signed-off-by: Sri Harsha <sri_harsha509@hotmail.com> * [docs]: Updating sample python code for browser manipulation Signed-off-by: Sri Harsha <sri_harsha509@hotmail.com> * [docs]: Updated python sample code for browser manipulation Signed-off-by: Sri Harsha <sri_harsha509@hotmail.com>
1 parent e8d4cd5 commit 5ee5132

6 files changed

+66
-24
lines changed

docs_source_files/content/webdriver/browser_manipulation.en.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,19 @@ queried using _window.frames_ in JavaScript.
647647
driver.switchTo().frame(1);
648648
{{< / code-panel >}}
649649
{{< code-panel language="ruby" >}}
650-
# We don't have a Ruby code sample yet - Help us out and raise a PR
650+
# Switch to the second frame
651+
driver.switch_to.frame(1)
651652
{{< / code-panel >}}
652653
{{< code-panel language="csharp" >}}
653654
// Switches to the second frame
654655
driver.SwitchTo().Frame(1);
655656
{{< / code-panel >}}
656657
{{< code-panel language="python" >}}
657-
# We don't have a Python code sample yet - Help us out and raise a PR
658+
# switching to second iframe based on index
659+
iframe = driver.find_elements_by_tag_name('iframe')[1]
660+
661+
# switch to selected iframe
662+
driver.switch_to.frame(iframe)
658663
{{< / code-panel >}}
659664
{{< code-panel language="javascript" >}}
660665
// Switches to the second frame
@@ -674,14 +679,16 @@ like so:
674679
driver.switchTo().defaultContent();
675680
{{< / code-panel >}}
676681
{{< code-panel language="python" >}}
677-
# We don't have a Python code sample yet - Help us out and raise a PR
682+
# switch back to default content
683+
driver.switch_to.default_content()
678684
{{< / code-panel >}}
679685
{{< code-panel language="csharp" >}}
680686
// Return to the top level
681687
driver.SwitchTo().DefaultContent();
682688
{{< / code-panel >}}
683689
{{< code-panel language="ruby" >}}
684-
# We don't have a Ruby code sample yet - Help us out and raise a PR
690+
# Return to the top level
691+
driver.switch_to.default_content
685692
{{< / code-panel >}}
686693
{{< code-panel language="javascript" >}}
687694
// Return to the top level

docs_source_files/content/webdriver/browser_manipulation.es.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,19 @@ queried using _window.frames_ in JavaScript.
653653
driver.switchTo().frame(1);
654654
{{< / code-panel >}}
655655
{{< code-panel language="ruby" >}}
656-
# We don't have a Ruby code sample yet - Help us out and raise a PR
656+
# Switch to the second frame
657+
driver.switch_to.frame(1)
657658
{{< / code-panel >}}
658659
{{< code-panel language="csharp" >}}
659660
// Switches to the second frame
660661
driver.SwitchTo().Frame(1);
661662
{{< / code-panel >}}
662663
{{< code-panel language="python" >}}
663-
# We don't have a Python code sample yet - Help us out and raise a PR
664+
# switching to second iframe based on index
665+
iframe = driver.find_elements_by_tag_name('iframe')[1]
666+
667+
# switch to selected iframe
668+
driver.switch_to.frame(iframe)
664669
{{< / code-panel >}}
665670
{{< code-panel language="javascript" >}}
666671
// Switches to the second frame
@@ -680,14 +685,16 @@ like so:
680685
driver.switchTo().defaultContent();
681686
{{< / code-panel >}}
682687
{{< code-panel language="python" >}}
683-
# We don't have a Python code sample yet - Help us out and raise a PR
688+
# switch back to default content
689+
driver.switch_to.default_content()
684690
{{< / code-panel >}}
685691
{{< code-panel language="csharp" >}}
686692
// Return to the top level
687693
driver.SwitchTo().DefaultContent();
688694
{{< / code-panel >}}
689695
{{< code-panel language="ruby" >}}
690-
# We don't have a Ruby code sample yet - Help us out and raise a PR
696+
# Return to the top level
697+
driver.switch_to.default_content
691698
{{< / code-panel >}}
692699
{{< code-panel language="javascript" >}}
693700
// Return to the top level

docs_source_files/content/webdriver/browser_manipulation.fr.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,19 @@ queried using _window.frames_ in JavaScript.
653653
driver.switchTo().frame(1);
654654
{{< / code-panel >}}
655655
{{< code-panel language="ruby" >}}
656-
# We don't have a Ruby code sample yet - Help us out and raise a PR
656+
# Switch to the second frame
657+
driver.switch_to.frame(1)
657658
{{< / code-panel >}}
658659
{{< code-panel language="csharp" >}}
659660
// Switches to the second frame
660661
driver.SwitchTo().Frame(1);
661662
{{< / code-panel >}}
662663
{{< code-panel language="python" >}}
663-
# We don't have a Python code sample yet - Help us out and raise a PR
664+
# switching to second iframe based on index
665+
iframe = driver.find_elements_by_tag_name('iframe')[1]
666+
667+
# switch to selected iframe
668+
driver.switch_to.frame(iframe)
664669
{{< / code-panel >}}
665670
{{< code-panel language="javascript" >}}
666671
// Switches to the second frame
@@ -680,14 +685,16 @@ like so:
680685
driver.switchTo().defaultContent();
681686
{{< / code-panel >}}
682687
{{< code-panel language="python" >}}
683-
# We don't have a Python code sample yet - Help us out and raise a PR
688+
# switch back to default content
689+
driver.switch_to.default_content()
684690
{{< / code-panel >}}
685691
{{< code-panel language="csharp" >}}
686692
// Return to the top level
687693
driver.SwitchTo().DefaultContent();
688694
{{< / code-panel >}}
689695
{{< code-panel language="ruby" >}}
690-
# We don't have a Ruby code sample yet - Help us out and raise a PR
696+
# Return to the top level
697+
driver.switch_to.default_content
691698
{{< / code-panel >}}
692699
{{< code-panel language="javascript" >}}
693700
// Return to the top level

docs_source_files/content/webdriver/browser_manipulation.ja.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -651,14 +651,19 @@ queried using _window.frames_ in JavaScript.
651651
driver.switchTo().frame(1);
652652
{{< / code-panel >}}
653653
{{< code-panel language="ruby" >}}
654-
# We don't have a Ruby code sample yet - Help us out and raise a PR
654+
# Switch to the second frame
655+
driver.switch_to.frame(1)
655656
{{< / code-panel >}}
656657
{{< code-panel language="csharp" >}}
657658
// Switches to the second frame
658659
driver.SwitchTo().Frame(1);
659660
{{< / code-panel >}}
660661
{{< code-panel language="python" >}}
661-
# We don't have a Python code sample yet - Help us out and raise a PR
662+
# switching to second iframe based on index
663+
iframe = driver.find_elements_by_tag_name('iframe')[1]
664+
665+
# switch to selected iframe
666+
driver.switch_to.frame(iframe)
662667
{{< / code-panel >}}
663668
{{< code-panel language="javascript" >}}
664669
// Switches to the second frame
@@ -678,14 +683,16 @@ like so:
678683
driver.switchTo().defaultContent();
679684
{{< / code-panel >}}
680685
{{< code-panel language="python" >}}
681-
# We don't have a Python code sample yet - Help us out and raise a PR
686+
# switch back to default content
687+
driver.switch_to.default_content()
682688
{{< / code-panel >}}
683689
{{< code-panel language="csharp" >}}
684690
// Return to the top level
685691
driver.SwitchTo().DefaultContent();
686692
{{< / code-panel >}}
687693
{{< code-panel language="ruby" >}}
688-
# We don't have a Ruby code sample yet - Help us out and raise a PR
694+
# Return to the top level
695+
driver.switch_to.default_content
689696
{{< / code-panel >}}
690697
{{< code-panel language="javascript" >}}
691698
// Return to the top level

docs_source_files/content/webdriver/browser_manipulation.nl.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,19 @@ queried using _window.frames_ in JavaScript.
653653
driver.switchTo().frame(1);
654654
{{< / code-panel >}}
655655
{{< code-panel language="ruby" >}}
656-
# We don't have a Ruby code sample yet - Help us out and raise a PR
656+
# Switch to the second frame
657+
driver.switch_to.frame(1)
657658
{{< / code-panel >}}
658659
{{< code-panel language="csharp" >}}
659660
// Switches to the second frame
660661
driver.SwitchTo().Frame(1);
661662
{{< / code-panel >}}
662663
{{< code-panel language="python" >}}
663-
# We don't have a Python code sample yet - Help us out and raise a PR
664+
# switching to second iframe based on index
665+
iframe = driver.find_elements_by_tag_name('iframe')[1]
666+
667+
# switch to selected iframe
668+
driver.switch_to.frame(iframe)
664669
{{< / code-panel >}}
665670
{{< code-panel language="javascript" >}}
666671
// Switches to the second frame
@@ -680,14 +685,16 @@ like so:
680685
driver.switchTo().defaultContent();
681686
{{< / code-panel >}}
682687
{{< code-panel language="python" >}}
683-
# We don't have a Python code sample yet - Help us out and raise a PR
688+
# switch back to default content
689+
driver.switch_to.default_content()
684690
{{< / code-panel >}}
685691
{{< code-panel language="csharp" >}}
686692
// Return to the top level
687693
driver.SwitchTo().DefaultContent();
688694
{{< / code-panel >}}
689695
{{< code-panel language="ruby" >}}
690-
# We don't have a Ruby code sample yet - Help us out and raise a PR
696+
# Return to the top level
697+
driver.switch_to.default_content
691698
{{< / code-panel >}}
692699
{{< code-panel language="javascript" >}}
693700
// Return to the top level

docs_source_files/content/webdriver/browser_manipulation.zh-cn.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,14 +652,19 @@ queried using _window.frames_ in JavaScript.
652652
driver.switchTo().frame(1);
653653
{{< / code-panel >}}
654654
{{< code-panel language="ruby" >}}
655-
# We don't have a Ruby code sample yet - Help us out and raise a PR
655+
# Switch to the second frame
656+
driver.switch_to.frame(1)
656657
{{< / code-panel >}}
657658
{{< code-panel language="csharp" >}}
658659
// Switches to the second frame
659660
driver.SwitchTo().Frame(1);
660661
{{< / code-panel >}}
661662
{{< code-panel language="python" >}}
662-
# We don't have a Python code sample yet - Help us out and raise a PR
663+
# switching to second iframe based on index
664+
iframe = driver.find_elements_by_tag_name('iframe')[1]
665+
666+
# switch to selected iframe
667+
driver.switch_to.frame(iframe)
663668
{{< / code-panel >}}
664669
{{< code-panel language="javascript" >}}
665670
// Switches to the second frame
@@ -679,14 +684,16 @@ like so:
679684
driver.switchTo().defaultContent();
680685
{{< / code-panel >}}
681686
{{< code-panel language="python" >}}
682-
# We don't have a Python code sample yet - Help us out and raise a PR
687+
# switch back to default content
688+
driver.switch_to.default_content()
683689
{{< / code-panel >}}
684690
{{< code-panel language="csharp" >}}
685691
// Return to the top level
686692
driver.SwitchTo().DefaultContent();
687693
{{< / code-panel >}}
688694
{{< code-panel language="ruby" >}}
689-
# We don't have a Ruby code sample yet - Help us out and raise a PR
695+
# Return to the top level
696+
driver.switch_to.default_content
690697
{{< / code-panel >}}
691698
{{< code-panel language="javascript" >}}
692699
// Return to the top level

0 commit comments

Comments
 (0)