upgaq.blogg.se

Install selenium ide addon in chrome and excel
Install selenium ide addon in chrome and excel









install selenium ide addon in chrome and excel install selenium ide addon in chrome and excel

All the commands up until the end command (line 9) will be run only if we are on an error page. If our error variable is greater than 0 that means we are on an error page. Line 6: The start of the if element exists magic. Not important, but you can see at the bottom of the window in the log it is indeed 1 when on an error page.

install selenium ide addon in chrome and excel

Line 5: Echo the error count for our example only. We store the value in a Selenium IDE variable named error. In our case the xpath is very specific and should return a value of 1 if we are showing an error page or a 0 if not. The simplest option is to store the number of items on the page that match a specific xpath. We can tell that we have an error page by looking for a tag with an id set to error-page. Line 3: We start by trying to open the restricted access page. The first couple of lines are not important to this example. Those details are not important our Selenium IDE if element exists logic they are provide to give some context of the commands you’ll see inside our if construct. This example is based on some links provided by the User Switching WordPress plugin and assumes our Super Admin switched to a standard user and can easily switch back. We are going to use this identifier to create some web app testing logic to switch back to a multisite super admin. A WordPress error page when attempting to access a restricted area.

install selenium ide addon in chrome and excel

Thankfully this page also comes with an easily identifiable body ID set to error-page. When trying to open a URL that is only available to the super admin an error page shows up. We can only execute our commands if we are a super admin. In this use case a WordPress multisite standard user is logged in. Here is a quick example using Selenium IDE 3 - the “new” Selenium IDE. Did you know you can tell Selenium IDE to execute certain commands only if a specific element exists on the page? The if element exists trick makes your web app testing scripts far more interesting.











Install selenium ide addon in chrome and excel