Skip to content

Commit bea9218

Browse files
authored
[rb] Move examples for ruby elements interactions (#1815)[deploy site]
Move examples for ruby elements interactions Co-authored-by: aguspe <[email protected]>
1 parent 7e6b13f commit bea9218

File tree

5 files changed

+47
-121
lines changed

5 files changed

+47
-121
lines changed

examples/ruby/spec/elements/interaction_spec.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,15 @@
44

55
RSpec.describe 'Element Interaction' do
66
let(:driver) { start_session }
7+
8+
before { driver.get 'https://www.selenium.dev/selenium/web/inputs.html' }
9+
10+
it 'clicks an element' do
11+
driver.find_element(name: 'color_input').click
12+
end
13+
14+
it 'clears and send keys to an element' do
15+
driver.find_element(name: 'email_input').clear
16+
driver.find_element(name: 'email_input').send_keys '[email protected]'
17+
end
718
end

website_and_docs/content/documentation/webdriver/elements/interactions.en.md

Lines changed: 9 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,9 @@ Selenium will return an [element click intercepted](https://w3c.github.io/webdri
6060
{{< tab header="CSharp" text=true >}}
6161
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}}
6262
{{< /tab >}}
63-
64-
{{< tab header="Ruby" >}}
65-
66-
# Navigate to URL
67-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
68-
69-
# Click the element
70-
driver.find_element(name: 'color_input').click
71-
72-
{{< /tab >}}
63+
{{< tab header="Ruby" text=true >}}
64+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L11" >}}
65+
{{< /tab >}}
7366
{{< tab header="JavaScript" text=true >}}
7467
{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L20" >}}
7568
{{< /tab >}}
@@ -118,20 +111,11 @@ possible keystrokes that WebDriver Supports.
118111
{{< tab header="CSharp" text=true >}}
119112
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}}
120113
{{< /tab >}}
121-
122-
123-
{{< tab header="Ruby" >}}
124114

125-
# Navigate to URL
126-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
127-
128-
# Clear field to empty it from any previous data
129-
driver.find_element(name: 'email_input').clear
130-
131-
# Enter Text
132-
driver.find_element(name: 'email_input').send_keys '[email protected]'
133115

134-
{{< /tab >}}
116+
{{< tab header="Ruby" text=true >}}
117+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L16" >}}
118+
{{< /tab >}}
135119
{{< tab header="JavaScript" text=true >}}
136120
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L21" >}}
137121
{{< /tab >}}
@@ -178,17 +162,11 @@ with a`content-editable` attribute. If these conditions are not met,
178162
{{< tab header="CSharp" text=true >}}
179163
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}}
180164
{{< /tab >}}
181-
182165

183-
{{< tab header="Ruby" >}}
184166

185-
# Navigate to URL
186-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
187-
188-
# Clear field to empty it from any previous data
189-
driver.find_element(name: 'email_input').clear
190-
191-
{{< /tab >}}
167+
{{< tab header="Ruby" text=true >}}
168+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L15" >}}
169+
{{< /tab >}}
192170
{{< tab header="JavaScript" text=true >}}
193171
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L20" >}}
194172
{{< /tab >}}

website_and_docs/content/documentation/webdriver/elements/interactions.ja.md

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,11 @@ Selenium will return an [element click intercepted](https://w3c.github.io/webdri
5656
{{< tab header="CSharp" text=true >}}
5757
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}}
5858
{{< /tab >}}
59-
60-
61-
{{< tab header="Ruby" >}}
62-
63-
# Navigate to URL
64-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
6559

66-
# Click the element
67-
driver.find_element(name: 'color_input').click
6860

69-
{{< /tab >}}
61+
{{< tab header="Ruby" text=true >}}
62+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L11" >}}
63+
{{< /tab >}}
7064
{{< tab header="JavaScript" text=true >}}
7165
{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L20" >}}
7266
{{< /tab >}}
@@ -115,18 +109,9 @@ possible keystrokes that WebDriver Supports.
115109
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}}
116110
{{< /tab >}}
117111

118-
{{< tab header="Ruby" >}}
119-
120-
# Navigate to URL
121-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
122-
123-
# Clear field to empty it from any previous data
124-
driver.find_element(name: 'email_input').clear
125-
126-
# Enter Text
127-
driver.find_element(name: 'email_input').send_keys '[email protected]'
128-
129-
{{< /tab >}}
112+
{{< tab header="Ruby" text=true >}}
113+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L16" >}}
114+
{{< /tab >}}
130115
{{< tab header="JavaScript" text=true >}}
131116
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L21" >}}
132117
{{< /tab >}}
@@ -172,17 +157,11 @@ with a`content-editable` attribute. If these conditions are not met,
172157
{{< tab header="CSharp" text=true >}}
173158
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}}
174159
{{< /tab >}}
175-
176-
177-
{{< tab header="Ruby" >}}
178160

179-
# Navigate to URL
180-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
181161

182-
# Clear field to empty it from any previous data
183-
driver.find_element(name: 'email_input').clear
184-
185-
{{< /tab >}}
162+
{{< tab header="Ruby" text=true >}}
163+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L15" >}}
164+
{{< /tab >}}
186165
{{< tab header="JavaScript" text=true >}}
187166
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L20" >}}
188167
{{< /tab >}}

website_and_docs/content/documentation/webdriver/elements/interactions.pt-br.md

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,9 @@ Selenium will return an [element click intercepted](https://w3c.github.io/webdri
5858
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}}
5959
{{< /tab >}}
6060

61-
{{< tab header="Ruby" >}}
62-
63-
# Navigate to URL
64-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
65-
66-
# Click the element
67-
driver.find_element(name: 'color_input').click
68-
69-
{{< /tab >}}
61+
{{< tab header="Ruby" text=true >}}
62+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L11" >}}
63+
{{< /tab >}}
7064
{{< tab header="JavaScript" text=true >}}
7165
{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L20" >}}
7266
{{< /tab >}}
@@ -116,18 +110,9 @@ possible keystrokes that WebDriver Supports.
116110
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}}
117111
{{< /tab >}}
118112

119-
{{< tab header="Ruby" >}}
120-
121-
# Navigate to URL
122-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
123-
124-
# Clear field to empty it from any previous data
125-
driver.find_element(name: 'email_input').clear
126-
127-
# Enter Text
128-
driver.find_element(name: 'email_input').send_keys '[email protected]'
129-
130-
{{< /tab >}}
113+
{{< tab header="Ruby" text=true >}}
114+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L16" >}}
115+
{{< /tab >}}
131116
{{< tab header="JavaScript" text=true >}}
132117
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L21" >}}
133118
{{< /tab >}}
@@ -173,16 +158,10 @@ with a`content-editable` attribute. If these conditions are not met,
173158
{{< tab header="CSharp" text=true >}}
174159
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}}
175160
{{< /tab >}}
176-
177-
{{< tab header="Ruby" >}}
178-
179-
# Navigate to URL
180-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
181161

182-
# Clear field to empty it from any previous data
183-
driver.find_element(name: 'email_input').clear
184-
185-
{{< /tab >}}
162+
{{< tab header="Ruby" text=true >}}
163+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L15" >}}
164+
{{< /tab >}}
186165
{{< tab header="JavaScript" text=true >}}
187166
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L20" >}}
188167
{{< /tab >}}

website_and_docs/content/documentation/webdriver/elements/interactions.zh-cn.md

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,10 @@ Selenium将返回一个 [元素点击中断](https://w3c.github.io/webdriver/#df
5959
{{< tab header="CSharp" text=true >}}
6060
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L17-L21" >}}
6161
{{< /tab >}}
62-
63-
{{< tab header="Ruby" >}}
64-
65-
# Navigate to URL
66-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
67-
68-
# Click the element
69-
driver.find_element(name: 'color_input').click
7062

71-
{{< /tab >}}
63+
{{< tab header="Ruby" text=true >}}
64+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L11" >}}
65+
{{< /tab >}}
7266
{{< tab header="JavaScript" text=true >}}
7367
{{< gh-codeblock path="examples/javascript/test/getting_started/firstScript.spec.js#L20" >}}
7468
{{< /tab >}}
@@ -117,20 +111,11 @@ Selenium将返回一个 [元素点击中断](https://w3c.github.io/webdriver/#df
117111
{{< tab header="CSharp" text=true >}}
118112
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L27-L33" >}}
119113
{{< /tab >}}
120-
121-
122-
{{< tab header="Ruby" >}}
123114

124-
# Navigate to URL
125-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
126115

127-
# Clear field to empty it from any previous data
128-
driver.find_element(name: 'email_input').clear
129-
130-
# Enter Text
131-
driver.find_element(name: 'email_input').send_keys '[email protected]'
132-
133-
{{< /tab >}}
116+
{{< tab header="Ruby" text=true >}}
117+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L16" >}}
118+
{{< /tab >}}
134119
{{< tab header="JavaScript" text=true >}}
135120
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L21" >}}
136121
{{< /tab >}}
@@ -177,16 +162,10 @@ Selenium将返回一个 [元素点击中断](https://w3c.github.io/webdriver/#df
177162
{{< tab header="CSharp" text=true >}}
178163
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InteractionTest.cs#L40-L43" >}}
179164
{{< /tab >}}
180-
181-
{{< tab header="Ruby" >}}
182-
183-
# Navigate to URL
184-
driver.get 'https://www.selenium.dev/selenium/web/inputs.html'
185165

186-
# Clear field to empty it from any previous data
187-
driver.find_element(name: 'email_input').clear
188-
189-
{{< /tab >}}
166+
{{< tab header="Ruby" text=true >}}
167+
{{< gh-codeblock path="examples/ruby/spec/elements/interaction_spec.rb#L15" >}}
168+
{{< /tab >}}
190169
{{< tab header="JavaScript" text=true >}}
191170
{{< gh-codeblock path="examples/javascript/test/elements/interactions.spec.js#L20" >}}
192171
{{< /tab >}}

0 commit comments

Comments
 (0)