@@ -36,19 +36,11 @@ e.g. http://example.com/some404page)
3636{{< tab header="CSharp" text=true >}}
3737{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/CookiesTest.cs#L32-L34" >}}
3838 {{< /tab >}}
39- {{< tab header="Ruby" >}}
40- require 'selenium-webdriver'
41- driver = Selenium::WebDriver.for : chrome
42-
43- begin
44- driver.get 'https://www.example.com '
4539
46- # Adds the cookie into current browser context
47- driver.manage.add_cookie(name: "key", value: "value")
48- ensure
49- driver.quit
50- end
40+ {{< tab header="Ruby" text=true >}}
41+ {{< gh-codeblock path="examples\ruby\spec\interactions\cookies_spec.rb#L14-L17" >}}
5142 {{< /tab >}}
43+
5244 {{< tab header="JavaScript" text=true >}}
5345{{< gh-codeblock path="/examples/javascript/test/interactions/cookies.spec.js#L18">}}
5446 {{< /tab >}}
@@ -85,20 +77,11 @@ It returns the serialized cookie data matching with the cookie name among all as
8577 {{< tab header="CSharp" text=true >}}
8678{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/CookiesTest.cs#L40-L44" >}}
8779 {{< /tab >}}
88- {{< tab header="Ruby" >}}
89- require 'selenium-webdriver'
90- driver = Selenium::WebDriver.for : chrome
91-
92- begin
93- driver.get 'https://www.example.com '
94- driver.manage.add_cookie(name: "foo", value: "bar")
95-
96- # Get cookie details with named cookie 'foo'
97- puts driver.manage.cookie_named('foo')
98- ensure
99- driver.quit
100- end
80+
81+ {{< tab header="Ruby" text=true >}}
82+ {{< gh-codeblock path="examples\ruby\spec\interactions\cookies_spec.rb#L19-L24" >}}
10183 {{< /tab >}}
84+
10285 {{< tab header="JavaScript" text=true >}}
10386{{< gh-codeblock path="/examples/javascript/test/interactions/cookies.spec.js#L35-L38">}}
10487 {{< /tab >}}
@@ -138,21 +121,11 @@ If browser is no longer available it returns error.
138121 {{< tab header="CSharp" text=true >}}
139122{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/CookiesTest.cs#L51-L64" >}}
140123 {{< /tab >}}
141- {{< tab header="Ruby" >}}
142- require 'selenium-webdriver'
143- driver = Selenium::WebDriver.for : chrome
144-
145- begin
146- driver.get 'https://www.example.com '
147- driver.manage.add_cookie(name: "test1", value: "cookie1")
148- driver.manage.add_cookie(name: "test2", value: "cookie2")
149-
150- # Get all available cookies
151- puts driver.manage.all_cookies
152- ensure
153- driver.quit
154- end
124+
125+ {{< tab header="Ruby" text=true >}}
126+ {{< gh-codeblock path="examples\ruby\spec\interactions\cookies_spec.rb#L26-L37" >}}
155127 {{< /tab >}}
128+
156129 {{< tab header="JavaScript" text=true >}}
157130{{< gh-codeblock path="/examples/javascript/test/interactions/cookies.spec.js#L49-L51">}}
158131 {{< /tab >}}
@@ -193,21 +166,11 @@ It deletes the cookie data matching with the provided cookie name.
193166 {{< tab header="CSharp" text=true >}}
194167{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/CookiesTest.cs#L70-L73" >}}
195168 {{< /tab >}}
196- {{< tab header="Ruby" >}}
197- require 'selenium-webdriver'
198- driver = Selenium::WebDriver.for : chrome
199-
200- begin
201- driver.get 'https://www.example.com '
202- driver.manage.add_cookie(name: "test1", value: "cookie1")
203- driver.manage.add_cookie(name: "test2", value: "cookie2")
204-
205- # delete a cookie with name 'test1'
206- driver.manage.delete_cookie('test1')
207- ensure
208- driver.quit
209- end
169+
170+ {{< tab header="Ruby" text=true >}}
171+ {{< gh-codeblock path="examples\ruby\spec\interactions\cookies_spec.rb#L39-L44" >}}
210172 {{< /tab >}}
173+
211174 {{< tab header="JavaScript" text=true >}}
212175{{< gh-codeblock path="/examples/javascript/test/interactions/cookies.spec.js#L61-L62">}}
213176 {{< /tab >}}
@@ -251,21 +214,11 @@ It deletes all the cookies of the current browsing context.
251214{{< tab header="CSharp" text=true >}}
252215{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Interactions/CookiesTest.cs#L92-L97" >}}
253216 {{< /tab >}}
254- {{< tab header="Ruby" >}}
255- require 'selenium-webdriver'
256- driver = Selenium::WebDriver.for : chrome
257-
258- begin
259- driver.get 'https://www.example.com '
260- driver.manage.add_cookie(name: "test1", value: "cookie1")
261- driver.manage.add_cookie(name: "test2", value: "cookie2")
262-
263- # deletes all cookies
264- driver.manage.delete_all_cookies
265- ensure
266- driver.quit
267- end
217+
218+ {{< tab header="Ruby" text=true >}}
219+ {{< gh-codeblock path="examples\ruby\spec\interactions\cookies_spec.rb#L54-L60" >}}
268220 {{< /tab >}}
221+
269222 {{< tab header="JavaScript" text=true >}}
270223{{< gh-codeblock path="/examples/javascript/test/interactions/cookies.spec.js#L77-L78">}}
271224 {{< /tab >}}
@@ -349,21 +302,11 @@ namespace SameSiteCookie {
349302 }
350303}
351304 {{< /tab >}}
352- {{< tab header="Ruby" >}}
353- require 'selenium-webdriver'
354- driver = Selenium::WebDriver.for : chrome
355-
356- begin
357- driver.get 'https://www.example.com '
358- # Adds the cookie into current browser context with sameSite 'Strict' (or) 'Lax'
359- driver.manage.add_cookie(name: "foo", value: "bar", same_site: "Strict")
360- driver.manage.add_cookie(name: "foo1", value: "bar", same_site: "Lax")
361- puts driver.manage.cookie_named('foo')
362- puts driver.manage.cookie_named('foo1')
363- ensure
364- driver.quit
365- end
366- {{< /tab >}}
305+
306+ {{< tab header="Ruby" text=true >}}
307+ {{< gh-codeblock path="examples\ruby\spec\interactions\cookies_spec.rb#L62-L81" >}}
308+ {{< /tab >}}
309+
367310 {{< tab header="JavaScript" text=true >}}
368311{{< gh-codeblock path="/examples/javascript/test/interactions/cookies.spec.js#L24-L26">}}
369312 {{< /tab >}}
0 commit comments