Pararel run using pabot cannot detect the locator for image

I use pabot for parallel run on linux, but when running in parallel it can’t detect the locator xpath=//img…
However, when you run just 1 testcase it can detect the locator, do you have any suggestions regarding this?

Hi Difaandika,

I guess the first thing to check here is, is this an expected result?

I’ll start with asking what is this image your locator is trying to locate? Is it a notification icon?

The reason I ask this is I’ve seen apps where if the same user is logged in in 2 (or more) browser sessions and the user receives a notification, one browser polls for the notification gets it and display’s it, then subsequent polls by the other browser sessions don’t get the notification as the first browser already cleared it by polling first. In this case it’s expected behaviour of the app.

Next step if you’ve determined this is not expected behaviour is to try and reproduce it manually with 2 browser windows, (I’m guessing here from the xpath it’s a browser based app?) you may (or maybe not) need to use one in incognito/private mode to separate the sessions. if you can reproduce it manually it’s an app issue not pabot, but that might also come back to the expected behaviour question.

Without a code example or a any detail on the app being tested, this is probably the best answer I can give you,


Hi Dave,
Thank you for the explanation. Because of I’m the new user so I can’t attach any image, But I think it’s just normal assertion for image

and here’s my code
${auto_filter_not_found_img} xpath=//img[@data-test-id='imgApplicantListEmptyState']

Check Not Found Job Selection
    Wait Until Element Is Visible    ${not_found_job_selection_title}
    Wait Until Element Is Visible    ${auto_filter_not_found_img} 

The locator can’t detected only if I run more than 1 pararel

Hi Difaandika,

So from Wait Until Element Is Visible I’m guessing you are using SeleniumLibrary? (for future reference this is the sort of thing to include in your question, it helps us help you a lot)

Assuming SeleniumLibrary, you probably got a screenshot when the Wait Until Element Is Visible step failed? if so, can you check if the image you are testing for is actually displayed on the page?

  • If it is not in the screen shot, then you’ve likely found a bug in the application you’re testing, no need to read further.
  • If it is displayed, then you probably need to do some more investigation and troubleshooting to find out why your xpath didn’t find it.

data-test-id is not a standard html tag attribute, so must be something custom you’re developers added or a development framework they are using added. An important question is if this is added server side or client side via javascript (aka ecmascript).

I would suggest to help with the troubleshooting, create a keyword called something like Capture Failed Page Details and use Log Source to get the html of the page when it fails it would look something like this:

Check Not Found Job Selection
    ${previous kw}= 	Register Keyword To Run On Failure 	Capture Failed Page Details
    Wait Until Element Is Visible    ${not_found_job_selection_title}
    Wait Until Element Is Visible    ${auto_filter_not_found_img}
    Register Keyword To Run On Failure 	${previous kw}

Capture Failed Page Details
    Capture Page Screenshot
    Log Source    INFO

Typically ${previous kw} will be Capture Page Screenshot

With this you can then inspect the html of the image you were trying to find and check if it actually has the data-test-id attribute, again if the image is there but the attribute is not, this might be a bug in the application you’re testing, or it might simply be that the client side scrips are taking too long to run and haven’t added the attribute yet, in which case you might need to consider a longer timeout on Wait Until Element Is Visible, something like 1 min? I believe the default timeouts in SeleniumLibrary are 1 second, so you will probably need longer than that. As a performance tester I like 10 minutes as a timeout cause it’s really hard for a developer to argue the script didn’t wait long enough (very few users will wait 10 min), but if you have all your steps in your regression suite waiting up to 10 minutes the run time for your regression suite could really blow out badly.

Wait Until Element Is Visible    ${auto_filter_not_found_img}    timeout=60 sec

Hopefully this helps you find the issue,