Skip to content

Noob here, couple of questions #2335

Answered by mdmintz
2k43l3aj5l asked this question in Q&A
Discussion options

You must be logged in to vote

Hello. The WebElement doesn't contain the seleniumbase methods (with a few exceptions for UC Mode).

Here's an example of slow_scroll_to():

from seleniumbase import SB

with SB() as sb:
    sb.open("https://xkcd.com/color/rgb/")
    sb.slow_scroll_to("center > table tbody tr:nth-child(36)")
    sb.sleep(1)

Use methods such as is_element_visible(selector) and is_element_present(selector) to handle flow-of-control. Eg:

if sb.is_element_visible(selector):
    # Do something here
else:
    # Do something else here

You can also use try/except blocks for error-handling. Eg:

try:
    # Do something here
except Exception:
    # Do something else here

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@2k43l3aj5l
Comment options

@mdmintz
Comment options

@mdmintz
Comment options

Answer selected by mdmintz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants