Skip to content

Commit 944cc17

Browse files
authored
Merge pull request #1327 from seleniumbase/recorder-updates
Make improvements to the Recorder
2 parents 1c76fd9 + b2169df commit 944cc17

File tree

5 files changed

+35
-15
lines changed

5 files changed

+35
-15
lines changed

README.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,22 @@ nosetests test_suite.py --report
626626
627627
(NOTE: You can add ``--show-report`` to immediately display Nosetest reports after the test suite completes. Only use ``--show-report`` when running tests locally because it pauses the test run.)
628628
629+
<h4><b>Behave Dashboard & Reports:</b></h4>
630+
631+
(The [behave_bdd/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples/behave_bdd) folder can be found in the [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) folder.)
632+
633+
```bash
634+
behave behave_bdd/features/ -D dashboard -D headless
635+
```
636+
637+
<img src="https://seleniumbase.io/cdn/img/sb_behave_dashboard.png" title="SeleniumBase" width="500">
638+
639+
You can also use ``--junit`` to get ``.xml`` reports for each Behave feature. Jenkins can use these files to display better reporting for your tests.
640+
641+
```bash
642+
behave behave_bdd/features/ --junit -D rs -D headless
643+
```
644+
629645
<h4><b>Allure Reports:</b></h4>
630646
631647
See: [https://docs.qameta.io/allure/](https://docs.qameta.io/allure/#_pytest)
@@ -695,17 +711,19 @@ pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1
695711
<h3><img src="https://seleniumbase.io/img/green_logo.png" title="SeleniumBase" width="32" /> Production Environments & Integrations:</h3>
696712
697713
<details>
698-
<summary>🔵 Here are some things you can do to set up a production environment for your testing.</summary>
714+
<summary>▶️ (expand) Here are some things you can do to set up a production environment for your testing.</summary>
699715
700-
* You can set up a [Jenkins](https://jenkins.io/) build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.
716+
<ul>
717+
<li>You can set up a <a href="https://jenkins.io/">Jenkins</a> build server for running tests at regular intervals. For a real-world Jenkins example of headless browser automation in action, check out the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/azure/jenkins/ReadMe.md">SeleniumBase Jenkins example on Azure</a> or the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/integrations/google_cloud/ReadMe.md">SeleniumBase Jenkins example on Google Cloud</a>.</li>
701718
702-
* You can use [the Selenium Grid](https://selenium.dev/documentation/en/grid/) to scale your testing by distributing tests on several machines with parallel execution. To do this, check out the [SeleniumBase selenium_grid folder](https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid), which should have everything you need, including the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">Selenium Grid ReadMe</a>, which will help you get started.
719+
<li>You can use <a href="https://selenium.dev/documentation/en/grid/">the Selenium Grid</a> to scale your testing by distributing tests on several machines with parallel execution. To do this, check out the<a href="https://github.com/seleniumbase/SeleniumBase/tree/master/seleniumbase/utilities/selenium_grid">SeleniumBase selenium_grid folder</a>, which should have everything you need, including the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/utilities/selenium_grid/ReadMe.md">Selenium Grid ReadMe</a>, which will help you get started.</li>
703720
704-
* If you're using the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mysql_installation.md">SeleniumBase MySQL feature</a> to save results from tests running on a server machine, you can install [MySQL Workbench](https://dev.mysql.com/downloads/tools/workbench/) to help you read & write from your DB more easily.
721+
<li>If you're using the <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/mysql_installation.md">SeleniumBase MySQL feature</a> to save results from tests running on a server machine, you can install <a href="https://dev.mysql.com/downloads/tools/workbench/">MySQL Workbench</a> to help you read & write from your DB more easily.</li>
705722
706-
* If you use [Slack](https://slack.com), you can easily have your Jenkins jobs display results there by using the [Jenkins Slack Plugin](https://github.com/jenkinsci/slack-plugin). Another way to send messages from your tests to Slack is by using [Slack's Incoming Webhooks API](https://api.slack.com/incoming-webhooks).
723+
<li>If you use <a href="https://slack.com">Slack</a>, you can easily have your Jenkins jobs display results there by using the <a href="https://github.com/jenkinsci/slack-plugin">Jenkins Slack Plugin</a>. Another way to send messages from your tests to Slack is by using <a href="https://api.slack.com/incoming-webhooks">Slack's Incoming Webhooks API</a>.</li>
707724
708-
* If you're using AWS, you can set up an [Amazon S3](https://aws.amazon.com/s3/) account for saving log files and screenshots from your tests. To activate this feature, modify [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) with connection details in the S3 section, and add "``--with-s3-logging``" on the command-line when running your tests.
725+
<li>If you're using AWS, you can set up an <a href="https://aws.amazon.com/s3/">Amazon S3</a> account for saving log files and screenshots from your tests. To activate this feature, modify <a href="https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py">settings.py</a> with connection details in the S3 section, and add <code>--with-s3-logging</code> on the command-line when running your tests.</li>
726+
</ul>
709727
710728
Here's an example of running tests with some additional features enabled:
711729
@@ -862,7 +880,7 @@ def is_there_a_cloaked_klingon_ship_on_this_page():
862880
```
863881
864882
<details>
865-
<summary>is_text_visible(text, selector) # is text visible on a page</summary>
883+
<summary>▶️ (expand) is_text_visible(text, selector) # is text visible on a page</summary>
866884
867885
```python
868886
def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
@@ -895,7 +913,7 @@ def get_mirror_universe_captain_picard_superbowl_ad(superbowl_year):
895913
896914
🔵 Switching Tabs:
897915
898-
<p>If your test opens up a new tab/window, you can switch to it. (SeleniumBase automatically switches to new tabs that don't open to ``about:blank`` URLs.)</p>
916+
<p>If your test opens up a new tab/window, you can switch to it. (SeleniumBase automatically switches to new tabs that don't open to <code>about:blank</code> URLs.)</p>
899917
900918
```python
901919
self.switch_to_window(1) # This switches to the new tab (0 is the first one)
@@ -927,7 +945,7 @@ self.activate_jquery()
927945
```
928946
929947
<details>
930-
<summary>🔵 Here are some examples of using jQuery in your scripts.</summary>
948+
<summary>▶️ (expand) Here are some examples of using jQuery in your scripts.</summary>
931949
932950
```python
933951
self.execute_script("jQuery, window.scrollTo(0, 600)") # Scrolling the page
@@ -956,7 +974,7 @@ self.execute_script("return jQuery('textarea')[2].value") # Returns the css "va
956974
🔵 Some websites have a restrictive [Content Security Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) to prevent users from loading jQuery and other external libraries onto their websites. If you need to use jQuery or another JS library on such a website, add ``--disable-csp`` on the command-line.
957975
958976
<details>
959-
<summary>🔵 In this example, JavaScript creates a referral button on a page, which is then clicked.</summary>
977+
<summary>▶️ (expand) In this example, JavaScript creates a referral button on a page, which is then clicked.</summary>
960978
961979
```python
962980
start_page = "https://xkcd.com/465/"
@@ -967,7 +985,7 @@ self.execute_script('''document.body.innerHTML = \"%s\"''' % referral_link)
967985
self.click("a.analytics") # Clicks the generated button
968986
```
969987
970-
(Due to popular demand, this traffic generation example has been included in SeleniumBase with the ``self.generate_referral(start_page, end_page)`` and the ``self.generate_traffic(start_page, end_page, loops)`` methods.)
988+
(Due to popular demand, this traffic generation example has been included in SeleniumBase with the <code>self.generate_referral(start_page, end_page)</code> and the <code>self.generate_traffic(start_page, end_page, loops)</code> methods.)
971989
972990
</details>
973991

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "3.1.0"
2+
__version__ = "3.1.1"

seleniumbase/console_scripts/rich_helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ def fix_emoji_spacing(code):
4141
"🗺️",
4242
"🖼️",
4343
"🗄️",
44-
"⏺️",
4544
"♻️",
4645
"🗂️",
4746
"🖥️",
4847
"🕹️",
4948
"🎞️",
5049
"🎛️",
5150
"🎖️",
51+
"⏺️",
52+
"▶️",
5253
"↘️",
5354
"⬇️",
5455
"↙️",

seleniumbase/extensions/recorder.zip

21 Bytes
Binary file not shown.

seleniumbase/js_code/recorder_js.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
if (el.id) {
1212
elid = el.id;
1313
if (elid.includes(',') || elid.includes('.') ||
14-
elid.includes('(') || elid.includes(')'))
14+
elid.includes('(') || elid.includes(')') || hasNumber(elid[0]))
1515
return cssPathByAttribute(el, 'id');
1616
selector += '#' + elid;
1717
path.unshift(selector);
@@ -110,7 +110,7 @@
110110
return el.tagName.toLowerCase();
111111
};
112112
function turnIntoParentAsNeeded(el) {
113-
if (tagName(el) == 'span') {
113+
if (tagName(el) == 'span' || tagName(el) == 'i') {
114114
if (tagName(el.parentElement) == 'button') {
115115
el = el.parentElement;
116116
}
@@ -148,6 +148,7 @@
148148
non_id_attributes.push('data-action');
149149
non_id_attributes.push('data-target');
150150
non_id_attributes.push('data-content');
151+
non_id_attributes.push('data-tooltip');
151152
non_id_attributes.push('alt');
152153
non_id_attributes.push('title');
153154
non_id_attributes.push('heading');

0 commit comments

Comments
 (0)