Skip to content

Commit 22fdaec

Browse files
authored
Merge pull request #194 from seleniumbase/framework-updates
Fix a bug and add a new method
2 parents ce5da2d + fc924dd commit 22fdaec

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

help_docs/features_list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<a id="feature_list"></a>
22
### ![http://seleniumbase.com](https://cdn2.hubspot.net/hubfs/100006/images/super_logo_tiny.png "SeleniumBase") **SeleniumBase Features:**
3-
* A versatile test automation framework for building & running Selenium scripts reliably.
3+
* A complete test automation framework for building & running reliable testing scripts.
44
* Uses [Pytest](https://docs.pytest.org/en/latest/) and [Nose](http://nose.readthedocs.io/en/latest/) runners for test discovery, organization, execution, and logging.
55
* Includes [console scripts](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/console_scripts/ReadMe.md) that save you time by installing web drivers automatically, etc.
66
* Includes a [website tour builder](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md) for creating and running walkthroughs on any website.

help_docs/method_summary.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ self.download_file(file_url, destination_folder=None)
150150

151151
self.save_file_as(file_url, new_file_name, destination_folder=None)
152152

153+
self.save_data_as(data, file_name, destination_folder=None)
154+
153155
self.get_downloads_folder(file)
154156

155157
self.get_path_of_downloaded_file(file)

seleniumbase/fixtures/base_case.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,7 +1051,8 @@ def play_tour(self, name=None, interval=0):
10511051
selector = re.search(
10521052
"[\S\s]+{element: '([\S\s]+)', on: [\S\s]+",
10531053
self._tour_steps[name][1]).group(1)
1054-
self.__wait_for_css_query_selector(
1054+
selector = selector.replace('\\', '')
1055+
self.wait_for_element_present(
10551056
selector, timeout=(settings.SMALL_TIMEOUT))
10561057
except Exception:
10571058
self.__post_messenger_error_message(
@@ -1614,7 +1615,8 @@ def safe_execute_script(self, script):
16141615

16151616
def download_file(self, file_url, destination_folder=None):
16161617
""" Downloads the file from the url to the destination folder.
1617-
If no destination folder is specified, the default one is used. """
1618+
If no destination folder is specified, the default one is used.
1619+
(The default downloads folder = "./downloaded_files") """
16181620
if not destination_folder:
16191621
destination_folder = constants.Files.DOWNLOADS_FOLDER
16201622
page_utils._download_file_to(file_url, destination_folder)
@@ -1627,6 +1629,14 @@ def save_file_as(self, file_url, new_file_name, destination_folder=None):
16271629
page_utils._download_file_to(
16281630
file_url, destination_folder, new_file_name)
16291631

1632+
def save_data_as(self, data, file_name, destination_folder=None):
1633+
""" Saves the data specified to a file of the name specified.
1634+
If no destination folder is specified, the default one is used.
1635+
(The default downloads folder = "./downloaded_files") """
1636+
if not destination_folder:
1637+
destination_folder = constants.Files.DOWNLOADS_FOLDER
1638+
page_utils._save_data_as(data, destination_folder, file_name)
1639+
16301640
def get_downloads_folder(self):
16311641
""" Returns the OS path of the Downloads Folder.
16321642
(Works with Chrome and Firefox only, for now.) """

seleniumbase/fixtures/page_utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
This module contains useful utility methods.
33
"""
4+
import codecs
45
import re
56
import requests
67

@@ -76,6 +77,12 @@ def _download_file_to(file_url, destination_folder, new_file_name=None):
7677
code.write(r.content)
7778

7879

80+
def _save_data_as(data, destination_folder, file_name):
81+
out_file = codecs.open(destination_folder + '/' + file_name, "w+")
82+
out_file.writelines(data)
83+
out_file.close()
84+
85+
7986
def _jq_format(code):
8087
"""
8188
DEPRECATED - Use re.escape() instead, which performs the intended action.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name='seleniumbase',
10-
version='1.14.4',
10+
version='1.14.5',
1111
description='Web Automation & Testing Framework - http://seleniumbase.com',
1212
long_description='Web Automation and Testing Framework - seleniumbase.com',
1313
platforms='Mac * Windows * Linux * Docker',

0 commit comments

Comments
 (0)