Skip to content

Commit 066345f

Browse files
authored
Merge pull request #378 from seleniumbase/update-console-scripts
Update console scripts
2 parents 2c9d04d + 3e3cb88 commit 066345f

File tree

9 files changed

+23
-86
lines changed

9 files changed

+23
-86
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[<img src="https://img.shields.io/github/release/seleniumbase/SeleniumBase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/releases) [<img src="https://dev.azure.com/seleniumbase/seleniumbase/_apis/build/status/seleniumbase.SeleniumBase?branchName=master" alt=" " />](https://dev.azure.com/seleniumbase/seleniumbase/_build/latest?definitionId=1&branchName=master) [<img src="https://travis-ci.org/seleniumbase/SeleniumBase.svg?branch=master" alt=" " />](https://travis-ci.org/seleniumbase/SeleniumBase) [<img src="https://badges.gitter.im/seleniumbase/SeleniumBase.svg" alt=" " />](https://gitter.im/seleniumbase/SeleniumBase) [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE) [<img src="https://img.shields.io/github/stars/seleniumbase/seleniumbase.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/stargazers)<br />
44

5-
All-in-one testing framework for automated E2E tests, [assisted-QA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), and [website tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).
5+
All-in-one framework for automated E2E testing, [assisted-QA](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/master_qa/ReadMe.md), and [website tours](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/tour_examples/ReadMe.md).
66

77
<img src="https://cdn2.hubspot.net/hubfs/100006/images/new_demo_gif.gif" title="SeleniumBase" height="225"><br />
88
(<i>Above: [my_first_test.py](https://github.com/seleniumbase/SeleniumBase/blob/master/examples/my_first_test.py) from [examples/](https://github.com/seleniumbase/SeleniumBase/tree/master/examples) running in demo mode, which adds JavaScript for highlighting page actions.</i>)<br />
@@ -12,23 +12,21 @@ pytest my_first_test.py --demo_mode
1212

1313
SeleniumBase uses [pytest](https://github.com/pytest-dev/pytest) for running Python scripts, while using [Selenium WebDriver](https://www.seleniumhq.org/) for controlling web browsers.
1414

15-
## <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Get Started:
15+
## Get Started:
1616

17-
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install Python:
17+
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install ``Python``: [<img src="https://img.shields.io/badge/python-2.7,_3.5,_3.6,_3.7+-22AADD.svg" alt=" " />](https://www.python.org/downloads/)
1818

19-
**[python.org/downloads/](https://www.python.org/downloads/)**
20-
[<img src="https://img.shields.io/badge/python-2.7,_3.5,_3.6,_3.7,_3.8+-22AADD.svg" alt=" " />](https://www.python.org/downloads/)
19+
Get it from **[python.org/downloads](https://www.python.org/downloads/)** and add Python to your System PATH.
2120

22-
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install/upgrade ``pip``:
21+
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Upgrade ``pip``:
2322

24-
With Python installed and on your System PATH, you can get the latest ``pip`` with:
2523
```bash
2624
python -m easy_install -U pip
2725
```
2826

29-
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Setup a Python Virtual Env:
27+
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Create a Python Virtual Env:
3028

31-
It is **recommended** to use a **Python Virtual Environment** to isolate Python dependencies between projects. Instructions on creating one can be found **[here](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md)**. (<i>Learn more about virtual environments on the **[official site](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)**.</i>)
29+
It is **recommended** to use a **Python Virtual Environment** to isolate Python dependencies between projects. Instructions on creating one can be found **[HERE](https://github.com/seleniumbase/SeleniumBase/blob/master/help_docs/virtualenv_instructions.md)**. (<i>Learn more about virtual environments on the **[official site](https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/)**.</i>)
3230

3331
### <img src="https://cdn2.hubspot.net/hubfs/100006/images/super_square_logo_3a.png" title="SeleniumBase" height="32"> Install ``seleniumbase``: [<img src="https://img.shields.io/badge/pypi-seleniumbase-22AAEE.svg" alt=" " />](https://pypi.python.org/pypi/seleniumbase)
3432
```bash
@@ -599,7 +597,7 @@ If the web page you're on already has jQuery loaded, you can start executing jQu
599597
You'd know this because the web page would contain something like the following in the HTML:
600598

601599
```html
602-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
600+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
603601
```
604602

605603
It's OK if you want to use jQuery on a page that doesn't have it loaded yet. To do so, run the following command first:
@@ -714,4 +712,4 @@ If you see something, say something! We are very active in resolving issues. [<i
714712

715713
[https://github.com/mdmintz](https://github.com/mdmintz)<br />
716714

717-
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo_2.png" title="SeleniumBase" height="120">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <br /> [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE)
715+
[<img src="https://cdn2.hubspot.net/hubfs/100006/images/sb_media_logo.png" title="SeleniumBase" height="120">](https://github.com/seleniumbase/SeleniumBase/blob/master/README.md) <br /> [<img src="https://img.shields.io/badge/license-MIT-22BBCC.svg" alt=" " />](https://github.com/seleniumbase/SeleniumBase/blob/master/LICENSE)

examples/boilerplates/samples/bing_objects.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

examples/boilerplates/samples/bing_test.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/boilerplates/samples/google_objects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ class HomePage(object):
1313

1414
class ResultsPage(object):
1515
google_logo = 'img[alt="Google"]'
16+
images_link = 'link=Images'
1617
search_results = 'div#center_col'

examples/boilerplates/samples/google_test.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,4 @@ def test_google_dot_com(self):
1616
self.assert_element(HomePage.feeling_lucky_button)
1717
self.click(HomePage.search_button)
1818
self.assert_text('github.com', ResultsPage.search_results)
19-
self.click_link_text('Images')
20-
source = self.get_page_source()
21-
self.assert_true("Image result for github" in source)
19+
self.assert_element(ResultsPage.images_link)

integrations/google_cloud/ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Building a browser-based test automation server on the [Google Cloud Platform](https://cloud.google.com/) by using [SeleniumBase](https://github.com/seleniumbase/SeleniumBase)
22

3-
(This tutorial, [from a previous GCP Meetup live demo](http://www.meetup.com/Boston-Google-Cloud-Meetup/events/230839686/?showDescription=true), will teach you how to setup a Linux server for running automated browser tests. The cost of running this server is [$14.20/month on Google Cloud](https://console.cloud.google.com/launcher/details/bitnami-launchpad/jenkins) (enough to handle **6 parallel tests**). This is amazingly **20 times LESS expensive** than using competitors such as [BrowserStack](https://www.browserstack.com/pricing) or [Sauce Labs](https://saucelabs.com/pricing) **for the SAME number of parallel tests**.)
3+
(This tutorial, [from a previous Google Cloud Meetup](http://www.meetup.com/Boston-Google-Cloud-Meetup/events/230839686/?showDescription=true), will teach you how to setup a Linux server for running automated browser tests. The cost of running this server is about [$13.61/month on Google Cloud](https://console.cloud.google.com/launcher/details/bitnami-launchpad/jenkins) (enough to handle **6 parallel tests**). This is much less expensive than using competitors such as [BrowserStack](https://www.browserstack.com/pricing) or [Sauce Labs](https://saucelabs.com/pricing) **for the SAME number of parallel tests**.)
44

55
#### Step 1. Open the Google Cloud Platform Cloud Launcher
66

seleniumbase/console_scripts/sb_mkdir.py

Lines changed: 2 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -196,41 +196,6 @@ def main():
196196
file.writelines("\r\n".join(data))
197197
file.close()
198198

199-
data = []
200-
data.append("from seleniumbase import BaseCase")
201-
data.append("from .bing_objects import Page")
202-
data.append("")
203-
data.append("")
204-
data.append("class BingTests(BaseCase):")
205-
data.append("")
206-
data.append(" def test_bing(self):")
207-
data.append(" self.open('https://bing.com')")
208-
data.append(" self.assert_text('Bing', Page.logo_box)")
209-
data.append(" self.update_text(Page.search_box, 'github')")
210-
data.append(" self.assert_element('li[query=\"github\"]')")
211-
data.append(" self.click(Page.search_button)")
212-
data.append(
213-
" self.assert_text('github.com', Page.search_results)")
214-
data.append(" self.click_link_text('Images')")
215-
data.append(" self.assert_element('img[alt*=\"github\"]')")
216-
data.append("")
217-
file_path = "%s/%s" % (dir_name_3, "bing_test.py")
218-
file = codecs.open(file_path, "w+", "utf-8")
219-
file.writelines("\r\n".join(data))
220-
file.close()
221-
222-
data = []
223-
data.append("class Page(object):")
224-
data.append(" logo_box = '#sbox div[class*=logo]'")
225-
data.append(" search_box = 'input.b_searchbox'")
226-
data.append(" search_button = 'input[name=\"go\"]'")
227-
data.append(" search_results = '#b_results'")
228-
data.append("")
229-
file_path = "%s/%s" % (dir_name_3, "bing_objects.py")
230-
file = codecs.open(file_path, "w+", "utf-8")
231-
file.writelines("\r\n".join(data))
232-
file.close()
233-
234199
data = []
235200
data.append("from seleniumbase import BaseCase")
236201
data.append("from .google_objects import HomePage, ResultsPage")
@@ -250,10 +215,7 @@ def main():
250215
data.append(
251216
" self.assert_text('github.com', "
252217
"ResultsPage.search_results)")
253-
data.append(" self.click_link_text('Images')")
254-
data.append(" source = self.get_page_source()")
255-
data.append(
256-
" self.assert_true('Image result for github' in source)")
218+
data.append(" self.assert_element(ResultsPage.images_link)")
257219
data.append("")
258220
file_path = "%s/%s" % (dir_name_3, "google_test.py")
259221
file = codecs.open(file_path, "w+", "utf-8")
@@ -273,6 +235,7 @@ def main():
273235
data.append("")
274236
data.append("class ResultsPage(object):")
275237
data.append(" google_logo = 'img[alt=\"Google\"]'")
238+
data.append(" images_link = 'link=Images'")
276239
data.append(" search_results = 'div#center_col'")
277240
data.append("")
278241
file_path = "%s/%s" % (dir_name_3, "google_objects.py")

seleniumbase/utilities/selenium_ide/objectify.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,9 +1314,15 @@ def main(shell_command):
13141314
object_name = "%s.%s" % (str(key), str(pair[0]))
13151315
object_dict[object_name] = pair[1]
13161316

1317+
good_sel_dict = {}
1318+
aa, bb, cc = scan_objects_file()
1319+
for s_key in selector_dict.keys():
1320+
if s_key in bb:
1321+
good_sel_dict[s_key] = selector_dict[s_key]
1322+
13171323
if shell_command == "inject-objects" or shell_command == "objectify":
13181324
seleniumbase_lines, page_selectors, changed = process_test_file(
1319-
code_lines, selector_dict=selector_dict, add_comments=add_comments)
1325+
code_lines, selector_dict=good_sel_dict, add_comments=add_comments)
13201326
added_classes = []
13211327
for item in changed:
13221328
if item not in added_classes:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
os.system('rm -f dist/*.egg; rm -f dist/*.tar.gz; rm -f dist/*.whl')
3636
os.system('python setup.py sdist bdist_wheel') # Create new tar/wheel
3737
print("\n*** Installing twine: *** (Required for PyPI uploads)\n")
38-
os.system("python -m pip install 'twine>=1.14.0'")
38+
os.system("python -m pip install 'twine>=1.15.0'")
3939
print("\n*** Publishing The Release to PyPI: ***\n")
4040
os.system('python -m twine upload dist/*') # Requires ~/.pypirc Keys
4141
print("\n*** The Release was PUBLISHED SUCCESSFULLY to PyPI! :) ***\n")
@@ -45,7 +45,7 @@
4545

4646
setup(
4747
name='seleniumbase',
48-
version='1.32.1',
48+
version='1.32.2',
4949
description='Fast, Easy, and Reliable Browser Automation & Testing.',
5050
long_description=long_description,
5151
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)