Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elements.get_text() doesn't work for Selenium #8

Closed
aleksslitvinovs opened this issue Feb 26, 2021 · 0 comments
Closed

Elements.get_text() doesn't work for Selenium #8

aleksslitvinovs opened this issue Feb 26, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@aleksslitvinovs
Copy link
Collaborator

Sample test

import pytest

from testui.support.appium_driver import NewDriver
from testui.support.testui_driver import TestUIDriver
from testui.elements.testui_element import e

@pytest.fixture(autouse=True)
def driver() -> TestUIDriver:
    driver = (
        NewDriver()
        .set_logger()
        .set_browser("chrome")
        .set_soft_assert(True)
        .set_selenium_driver()
    )

    yield driver

    driver.quit()

@pytest.mark.test
def test(driver: TestUIDriver) -> None:
    driver.navigate_to("http://example.com/")
    e(driver, "css", "body").wait_until_visible(seconds=10)
    text = e(driver, "css", "h1").wait_until_visible().get_text()

    print(f"H1 text: {text}")

Expected result

H1 text: Example Domain is printed out

Actual result

H1 text: None is printed out

Additional comments

Add type annotations where possible to improve autosuggestions in IDEs

ajpetersons added a commit that referenced this issue Mar 2, 2021
@aleksslitvinovs aleksslitvinovs added the bug Something isn't working label Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant