Skip to content

Commit fc3dca7

Browse files
authored
Merge pull request #283 from seleniumbase/small-updates
Clone an existing method with an additional name
2 parents 6d11358 + 50ec5a6 commit fc3dca7

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -181,19 +181,19 @@ from seleniumbase import BaseCase
181181
class MyTestClass(BaseCase):
182182

183183
def test_basic(self):
184-
self.open('https://xkcd.com/353/')
184+
self.open("https://xkcd.com/353/")
185185
self.assert_element('img[alt="Python"]')
186186
self.click('a[rel="license"]')
187-
self.assert_text('free to copy', 'div center')
187+
self.assert_text("free to copy", "div center")
188188
self.open("https://xkcd.com/1481/")
189189
title = self.get_attribute("#comic img", "title")
190190
self.assert_true("86,400 seconds per day" in title)
191-
self.click('link=Blag')
192-
self.assert_text('The blag of the webcomic', 'h2')
193-
self.update_text('input#s', 'Robots!\n')
194-
self.assert_text('Hooray robots!', '#content')
195-
self.open('https://xkcd.com/1319/')
196-
self.assert_text('Automation', 'div#ctitle')
191+
self.click("link=Blag")
192+
self.assert_text("The blag of the webcomic", "h2")
193+
self.update_text("input#s", "Robots!\n")
194+
self.assert_text("Hooray robots!", "#content")
195+
self.open("https://xkcd.com/1319/")
196+
self.assert_exact_text("Automation", "#ctitle")
197197
```
198198
(<i>By default, [CSS Selectors](https://www.w3schools.com/cssref/css_selectors.asp) are used for finding page elements.</i>)
199199

help_docs/method_summary.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ self.find_element(selector, by=By.CSS_SELECTOR, timeout=settings.LARGE_TIMEOUT)
256256
self.assert_element(
257257
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
258258

259+
self.assert_element_visible(
260+
selector, by=By.CSS_SELECTOR, timeout=settings.SMALL_TIMEOUT)
261+
259262
########
260263

261264
self.wait_for_text_visible(text, selector="html", by=By.CSS_SELECTOR,

seleniumbase/fixtures/base_case.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,6 +2051,15 @@ def assert_element(self, selector, by=By.CSS_SELECTOR,
20512051
self.__highlight_with_assert_success(messenger_post, selector, by)
20522052
return True
20532053

2054+
def assert_element_visible(self, selector, by=By.CSS_SELECTOR,
2055+
timeout=settings.SMALL_TIMEOUT):
2056+
""" Same as self.assert_element()
2057+
As above, will raise an exception if nothing can be found. """
2058+
if self.timeout_multiplier and timeout == settings.SMALL_TIMEOUT:
2059+
timeout = self.__get_new_timeout(timeout)
2060+
self.assert_element(selector, by=by, timeout=timeout)
2061+
return True
2062+
20542063
# For backwards compatibility, earlier method names of the next
20552064
# four methods have remained even though they do the same thing,
20562065
# with the exception of assert_*, which won't return the element,

setup.py

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

1818
setup(
1919
name='seleniumbase',
20-
version='1.19.6',
20+
version='1.19.7',
2121
description='Reliable Browser Automation & Testing Framework',
2222
long_description=long_description,
2323
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)