Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
SeleniumHQ
GitHub Repository: SeleniumHQ/Selenium
Path: blob/trunk/py/test/selenium/webdriver/common/repr_tests.py
1865 views
1
# Licensed to the Software Freedom Conservancy (SFC) under one
2
# or more contributor license agreements. See the NOTICE file
3
# distributed with this work for additional information
4
# regarding copyright ownership. The SFC licenses this file
5
# to you under the Apache License, Version 2.0 (the
6
# "License"); you may not use this file except in compliance
7
# with the License. You may obtain a copy of the License at
8
#
9
# http://www.apache.org/licenses/LICENSE-2.0
10
#
11
# Unless required by applicable law or agreed to in writing,
12
# software distributed under the License is distributed on an
13
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
# KIND, either express or implied. See the License for the
15
# specific language governing permissions and limitations
16
# under the License.
17
18
19
from selenium.webdriver.common.by import By
20
from selenium.webdriver.support.wait import WebDriverWait
21
22
23
def test_should_implement_repr_for_web_driver(driver):
24
driver_repr = repr(driver)
25
assert type(driver).__name__ in driver_repr
26
assert driver.session_id in driver_repr
27
28
29
def test_should_implement_repr_for_web_element(driver, pages):
30
pages.load("simpleTest.html")
31
elem = driver.find_element(By.ID, "validImgTag")
32
elem_repr = repr(elem)
33
assert type(elem).__name__ in elem_repr
34
assert driver.session_id in elem_repr
35
assert elem._id in elem_repr
36
37
38
def test_should_implement_repr_for_wait(driver):
39
wait = WebDriverWait(driver, 30)
40
wait_repr = repr(wait)
41
assert type(wait).__name__ in wait_repr
42
assert driver.session_id in wait_repr
43
44