Try and except
RPA.Browser.Selenium.Open Available Browser https://newepco.dagangnet.com.my/dnex/dnex_app/# #headless=${True}
TRY
RPA.Browser.Selenium.Wait Until Element Is Visible css:#txt_usernameabc
EXCEPT Element 'Element css:#txt_usernameabc' not visible after 5 seconds.:
Log Not found
EXCEPT NoSuchWindowException:
Log No Window
END
The above is my code for the try/except code, when the RPA.Browser.Selenium.Wait Until Element Is Visible css:#txt_usernameabc is failed, why it doesn’t go through the exception?
A bigger difference is that with Python exceptions are objects
and with Robot Framework you are dealing with error messages as strings.
By default matching an error using EXCEPT requires an exact match.
So you either need to use exact match or use other more flexible catching
Why after the TRY keyword fails, it doesn’t go to the except? As you can see the timeout is 3 mins, but the log file showing 4 mins and it doesn’t move to the next step. I have to manually close the browser by myself, to make the EXCEPT to continue to run.
and the Wait Until Element Is Visible css:#txt_fob_val timeout=3 mins fails is because out of memory, so if it’s out of memory i want the robot to close the browser:
TRY
Wait Until Element Is Visible css:#txt_fob_val timeout=3 mins
EXCEPT
Close Browser
Start DNEX
Second time
ELSE
Input Text css:#txt_fob_val ${excel_Total price}
Click Element css:#cmd_save_product_detail
END
the except fails because i cancel the execution, as i mentioned the
Wait Until Element Is Visible css:#txt_fob_val timeout=3 mins
fails, and it doesn’t close the browser automatically, so i close the browser manually, it only then run the except execution, as i know the code has smthing wrong, so i cancel the execution, that’s why the except here shows failed
So if you are not manually closing browser execution just freezes and no timeout occurs for any of the keywords inside EXCEPT block? What do your keywords Start DNEX and Second time contain?