Skip to content

Commit 8a84e31

Browse files
authored
Merge branch 'trunk' into renovate/rubocop-1.x-lockfile
2 parents 07d463d + 4567a5a commit 8a84e31

File tree

27 files changed

+250
-381
lines changed

27 files changed

+250
-381
lines changed

examples/dotnet/SeleniumDocs/BiDi/CDP/NetworkTest.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
using OpenQA.Selenium;
55
using OpenQA.Selenium.DevTools;
66
using System.Linq;
7-
using OpenQA.Selenium.DevTools.V130.Network;
8-
using OpenQA.Selenium.DevTools.V130.Performance;
7+
using OpenQA.Selenium.DevTools.V131.Network;
8+
using OpenQA.Selenium.DevTools.V131.Performance;
99

1010

1111
namespace SeleniumDocs.BiDi.CDP
@@ -16,7 +16,7 @@ public class NetworkTest : BaseTest
1616
[TestInitialize]
1717
public void Startup()
1818
{
19-
StartDriver("130");
19+
StartDriver("131");
2020
}
2121

2222
[TestMethod]
@@ -109,9 +109,9 @@ public async Task PerformanceMetrics()
109109
driver.Url = "https://www.selenium.dev/selenium/web/frameset.html";
110110

111111
var session = ((IDevTools)driver).GetDevToolsSession();
112-
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V130.DevToolsSessionDomains>();
112+
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V131.DevToolsSessionDomains>();
113113

114-
await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V130.Performance.EnableCommandSettings());
114+
await domains.Performance.Enable(new OpenQA.Selenium.DevTools.V131.Performance.EnableCommandSettings());
115115
var metricsResponse =
116116
await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
117117
new GetMetricsCommandSettings()
@@ -130,8 +130,8 @@ await session.SendCommand<GetMetricsCommandSettings, GetMetricsCommandResponse>(
130130
public async Task SetCookie()
131131
{
132132
var session = ((IDevTools)driver).GetDevToolsSession();
133-
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V130.DevToolsSessionDomains>();
134-
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V130.Network.EnableCommandSettings());
133+
var domains = session.GetVersionSpecificDomains<OpenQA.Selenium.DevTools.V131.DevToolsSessionDomains>();
134+
await domains.Network.Enable(new OpenQA.Selenium.DevTools.V131.Network.EnableCommandSettings());
135135

136136
var cookieCommandSettings = new SetCookieCommandSettings
137137
{

examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,4 +205,16 @@ public void setContext() {
205205

206206
driver.quit();
207207
}
208+
209+
@Test
210+
public void firefoxProfile() {
211+
FirefoxProfile profile = new FirefoxProfile();
212+
FirefoxOptions options = new FirefoxOptions();
213+
profile.setPreference("javascript.enabled", "False");
214+
options.setProfile(profile);
215+
216+
driver = new FirefoxDriver(options);
217+
218+
driver.quit();
219+
}
208220
}

examples/python/tests/browsers/test_firefox.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,17 @@ def test_set_context(firefox_driver):
151151

152152
# Check if the context is back to content
153153
assert driver.execute("GET_CONTEXT")["value"] == "content"
154+
155+
156+
def test_firefox_profile():
157+
from selenium.webdriver.firefox.options import Options
158+
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
159+
160+
options = Options()
161+
firefox_profile = FirefoxProfile()
162+
firefox_profile.set_preference("javascript.enabled", False)
163+
options.profile = firefox_profile
164+
165+
driver = webdriver.Firefox(options=options)
166+
167+
driver.quit()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
11
from selenium import webdriver
2+
from selenium.webdriver.common.by import By
23

4+
import pytest
5+
6+
7+
def test_informarion():
8+
# Initialize WebDriver
9+
driver = webdriver.Chrome()
10+
driver.implicitly_wait(0.5)
11+
12+
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
13+
14+
# isDisplayed
15+
is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed()
16+
assert is_email_visible == True
17+
18+
# isEnabled
19+
is_enabled_button = driver.find_element(By.NAME, "button_input").is_enabled()
20+
assert is_enabled_button == True
21+
22+
# isSelected
23+
is_selected_check = driver.find_element(By.NAME, "checkbox_input").is_selected()
24+
assert is_selected_check == True
25+
26+
# TagName
27+
tag_name_inp = driver.find_element(By.NAME, "email_input").tag_name
28+
assert tag_name_inp == "input"
29+
30+
# GetRect
31+
rect = driver.find_element(By.NAME, "range_input").rect
32+
assert rect["x"] == 10
33+
34+
# CSS Value
35+
css_value = driver.find_element(By.NAME, "color_input").value_of_css_property(
36+
"font-size"
37+
)
38+
assert css_value == "13.3333px"
39+
40+
# GetText
41+
text = driver.find_element(By.TAG_NAME, "h1").text
42+
assert text == "Testing Inputs"
43+
44+
# FetchAttributes
45+
email_txt = driver.find_element(By.NAME, "email_input")
46+
value_info = email_txt.get_attribute("value")
47+
assert value_info == "admin@localhost"

website_and_docs/content/documentation/webdriver/browsers/firefox.en.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -102,20 +102,12 @@ There are several ways to work with Firefox profiles.
102102

103103
{{< tabpane langEqualsHeader=true >}}
104104
{{< badge-examples >}}
105-
{{< tab header="Java" >}}
106-
FirefoxProfile profile = new FirefoxProfile();
107-
FirefoxOptions options = new FirefoxOptions();
108-
options.setProfile(profile);
109-
driver = new FirefoxDriver(options);
110-
{{< /tab >}}
111-
{{< tab header="Python" >}}
112-
from selenium.webdriver.firefox.options import Options
113-
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
114-
options=Options()
115-
firefox_profile = FirefoxProfile()
116-
firefox_profile.set_preference("javascript.enabled", False)
117-
options.profile = firefox_profile
118-
{{< /tab >}}
105+
{{< tab header="Java" text=true >}}
106+
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
107+
{{< /tab >}}
108+
{{< tab header="Python" text=true >}}
109+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
110+
{{< /tab >}}
119111
{{< tab header="CSharp" >}}
120112
var options = new FirefoxOptions();
121113
var profile = new FirefoxProfile();

website_and_docs/content/documentation/webdriver/browsers/firefox.ja.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,13 @@ Firefoxプロファイルを操作するにはいくつかの方法がありま
106106

107107
<div>
108108
{{< tabpane langEqualsHeader=true >}}
109-
{{< tab header="Java" >}}
110-
FirefoxProfile profile = new FirefoxProfile();
111-
FirefoxOptions options = new FirefoxOptions();
112-
options.setProfile(profile);
113-
driver = new RemoteWebDriver(options);
114-
{{< /tab >}}
115-
{{< tab header="Python" >}}
116-
from selenium.webdriver.firefox.options import Options
117-
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
118-
options=Options()
119-
firefox_profile = FirefoxProfile()
120-
firefox_profile.set_preference("javascript.enabled", False)
121-
options.profile = firefox_profile
122-
{{< /tab >}}
123-
{{< tab header="CSharp" >}}
109+
{{< tab header="Java" text=true >}}
110+
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
111+
{{< /tab >}}
112+
{{< tab header="Python" text=true >}}
113+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
114+
{{< /tab >}}
115+
{{< tab header="CSharp" >}}
124116
var options = new FirefoxOptions();
125117
var profile = new FirefoxProfile();
126118
options.Profile = profile;

website_and_docs/content/documentation/webdriver/browsers/firefox.pt-br.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,12 @@ Existem várias formas de trabalhar com perfis Firefox
105105

106106
<div>
107107
{{< tabpane langEqualsHeader=true >}}
108-
{{< tab header="Java" >}}
109-
FirefoxProfile profile = new FirefoxProfile();
110-
FirefoxOptions options = new FirefoxOptions();
111-
options.setProfile(profile);
112-
driver = new RemoteWebDriver(options);
113-
{{< /tab >}}
114-
{{< tab header="Python" >}}
115-
from selenium.webdriver.firefox.options import Options
116-
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
117-
options=Options()
118-
firefox_profile = FirefoxProfile()
119-
firefox_profile.set_preference("javascript.enabled", False)
120-
options.profile = firefox_profile
121-
{{< /tab >}}
108+
{{< tab header="Java" text=true >}}
109+
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
110+
{{< /tab >}}
111+
{{< tab header="Python" text=true >}}
112+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
113+
{{< /tab >}}
122114
{{< tab header="CSharp" >}}
123115
var options = new FirefoxOptions();
124116
var profile = new FirefoxProfile();

website_and_docs/content/documentation/webdriver/browsers/firefox.zh-cn.md

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,12 @@ There are several ways to work with Firefox profiles
104104

105105
<div>
106106
{{< tabpane langEqualsHeader=true >}}
107-
{{< tab header="Java" >}}
108-
FirefoxProfile profile = new FirefoxProfile();
109-
FirefoxOptions options = new FirefoxOptions();
110-
options.setProfile(profile);
111-
driver = new RemoteWebDriver(options);
112-
{{< /tab >}}
113-
{{< tab header="Python" >}}
114-
from selenium.webdriver.firefox.options import Options
115-
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
116-
options=Options()
117-
firefox_profile = FirefoxProfile()
118-
firefox_profile.set_preference("javascript.enabled", False)
119-
options.profile = firefox_profile
120-
{{< /tab >}}
107+
{{< tab header="Java" text=true >}}
108+
{{< gh-codeblock path="/examples/java/src/test/java/dev/selenium/browsers/FirefoxTest.java#L211-L216" >}}
109+
{{< /tab >}}
110+
{{< tab header="Python" text=true >}}
111+
{{< gh-codeblock path="/examples/python/tests/browsers/test_firefox.py#L157-L165" >}}
112+
{{< /tab >}}
121113
{{< tab header="CSharp" >}}
122114
var options = new FirefoxOptions();
123115
var profile = new FirefoxProfile();

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

Lines changed: 16 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ nature and relationship in the tree to return a value.
2929
{{< tab header="Java" text=true >}}
3030
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L20-L25" >}}
3131
{{< /tab >}}
32-
{{< tab header="Python" >}}
33-
# Navigate to the url
34-
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
35-
36-
# Get boolean value for is element display
37-
is_email_visible = driver.find_element(By.NAME, "email_input").is_displayed()
32+
{{< tab header="Python" text=true >}}
33+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L12-L15" >}}
3834
{{< /tab >}}
3935
{{< tab header="CSharp" text=true >}}
4036
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L18-L23" >}}
@@ -68,12 +64,8 @@ Returns a boolean value, **True** if the connected element is
6864
{{< tab header="Java" text=true >}}
6965
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L27-L30" >}}
7066
{{< /tab >}}
71-
{{< tab header="Python" >}}
72-
# Navigate to url
73-
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
74-
75-
# Returns true if element is enabled else returns false
76-
value = driver.find_element(By.NAME, 'button_input').is_enabled()
67+
{{< tab header="Python" text=true >}}
68+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L19" >}}
7769
{{< /tab >}}
7870
{{< tab header="CSharp" text=true >}}
7971
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L25-L28" >}}
@@ -106,12 +98,8 @@ Returns a boolean value, **True** if referenced element is
10698
{{< tab header="Java" text=true >}}
10799
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L32-L35" >}}
108100
{{< /tab >}}
109-
{{< tab header="Python" >}}
110-
# Navigate to url
111-
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
112-
113-
# Returns true if element is checked else returns false
114-
value = driver.find_element(By.NAME, "checkbox_input").is_selected()
101+
{{< tab header="Python" text=true >}}
102+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L23" >}}
115103
{{< /tab >}}
116104
{{< tab header="CSharp" text=true >}}
117105
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L30-L33" >}}
@@ -140,12 +128,8 @@ of the referenced Element which has the focus in the current browsing context.
140128
{{< tab header="Java" text=true >}}
141129
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L37-L40" >}}
142130
{{< /tab >}}
143-
{{< tab header="Python" >}}
144-
# Navigate to url
145-
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
146-
147-
# Returns TagName of the element
148-
attr = driver.find_element(By.NAME, "email_input").tag_name
131+
{{< tab header="Python" text=true >}}
132+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L27" >}}
149133
{{< /tab >}}
150134
{{< tab header="CSharp" text=true >}}
151135
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L35-L38" >}}
@@ -180,12 +164,8 @@ The fetched data body contain the following details:
180164
{{< tab header="Java" text=true >}}
181165
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L42-L46" >}}
182166
{{< /tab >}}
183-
{{< tab header="Python" >}}
184-
# Navigate to url
185-
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
186-
187-
# Returns height, width, x and y coordinates referenced element
188-
res = driver.find_element(By.NAME, "range_input").rect
167+
{{< tab header="Python" text=true >}}
168+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L31" >}}
189169
{{< /tab >}}
190170
{{< tab header="CSharp" text=true >}}
191171
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L40-L47" >}}
@@ -217,13 +197,8 @@ of an element in the current browsing context.
217197
{{< tab header="Java" text=true >}}
218198
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L49-L51" >}}
219199
{{< /tab >}}
220-
{{< tab header="Python" >}}
221-
222-
# Navigate to Url
223-
driver.get('https://www.selenium.dev/selenium/web/colorPage.html')
224-
225-
# Retrieves the computed style property 'color' of linktext
226-
cssValue = driver.find_element(By.ID, "namedColor").value_of_css_property('background-color')
200+
{{< tab header="Python" text=true >}}
201+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L35-L37" >}}
227202
{{< /tab >}}
228203
{{< tab header="CSharp" text=true >}}
229204
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L49-L51" >}}
@@ -253,12 +228,8 @@ Retrieves the rendered text of the specified element.
253228
{{< tab header="Java" text=true >}}
254229
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L54-L57" >}}
255230
{{< /tab >}}
256-
{{< tab header="Python" >}}
257-
# Navigate to url
258-
driver.get("https://www.selenium.dev/selenium/web/linked_image.html")
259-
260-
# Retrieves the text of the element
261-
text = driver.find_element(By.ID, "justanotherlink").text
231+
{{< tab header="Python" text=true >}}
232+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L41" >}}
262233
{{< /tab >}}
263234
{{< tab header="CSharp" text=true >}}
264235
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L53-L56" >}}
@@ -290,15 +261,8 @@ with the DOM attribute or property of the element.
290261
{{< tab header="Java" text=true >}}
291262
{{< gh-codeblock path="examples/java/src/test/java/dev/selenium/elements/InformationTest.java#L60-L65" >}}
292263
{{< /tab >}}
293-
{{< tab header="Python" >}}
294-
# Navigate to the url
295-
driver.get("https://www.selenium.dev/selenium/web/inputs.html")
296-
297-
# Identify the email text box
298-
email_txt = driver.find_element(By.NAME, "email_input")
299-
300-
# Fetch the value property associated with the textbox
301-
value_info = email_txt.get_attribute("value")
264+
{{< tab header="Python" text=true >}}
265+
{{< gh-codeblock path="examples/python/tests/elements/test_information.py#L44-L46" >}}
302266
{{< /tab >}}
303267
{{< tab header="CSharp" text=true >}}
304268
{{< gh-codeblock path="examples/dotnet/SeleniumDocs/Elements/InformationTest.cs#L58-L63" >}}

0 commit comments

Comments
 (0)