SeleniumBase/examples/test_contains_selector.py

14 lines
558 B
Python
Raw Normal View History

2023-01-19 13:07:40 +08:00
"""TAG:contains("TEXT") is a special, non-standard CSS Selector
2022-10-30 11:29:55 +08:00
that gets converted to XPath: '//TAG[contains(., "TEXT")]'
2023-01-19 13:07:40 +08:00
before it's used by Selenium calls. Also part of jQuery."""
from seleniumbase import BaseCase
2023-01-19 13:07:40 +08:00
BaseCase.main(__name__, __file__)
2021-03-11 06:27:52 +08:00
class ContainsSelectorTests(BaseCase):
def test_contains_selector(self):
self.open("https://xkcd.com/2207/")
self.assert_element('div.box div:contains("Math Work")')
self.click('a:contains("Next")')
self.assert_element('div div:contains("Drone Fishing")')