Home>

I have a question about Katalon Recorder.
If an error line appears, such as where to click is not found, the operation stops,
Can you ignore the error and continue?

or using an IF statement
Click when this element is present
Can't you do things like that?

  • Answer # 1

    This is a very rough question, so I can only give a rough answer.
    There are two ways to find errors when scraping.
    The following is an example of python, but it is
    for languages ​​around the world There should be a function to do the same processing.

    Part 1. Determine if there is a specific element in the if statement
    In the example, it is determined whether or not there is even one element whose class attribute is hogehoge

    if len (driver.find_elements_by_class_name ('hogehoge'))>0:
        # Process when there is a specific element
    else:
        # Process when there is no specific element


    Part 2. Exception handling with try-except
    In the example, when trying to click an element whose class attribute is hogehoge
    Processing when an error is reported that there is no such element

    try:
        driver.find_element_by_class_name ('hogehoge'). click ()
        # Process when there is a specific element
    except NoSuchElementException:
        # Process when a specific element is not found