# Log to Console and Should be equal issues in Robot Framework

**URL:** <https://forum.robotframework.org/t/log-to-console-and-should-be-equal-issues-in-robot-framework/6663>\
**Category:** Robot Framework\
**Created:** [15 January 2024 17:20 UTC](https://forum.robotframework.org/t/log-to-console-and-should-be-equal-issues-in-robot-framework/6663 "2024-01-15T17:20:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adskul](https://avatars.discourse-cdn.com/v4/letter/a/a3d4f5/32.png) [@adskul](https://forum.robotframework.org/u/adskul)\
**Post date:** [15 January 2024 17:20 UTC](https://forum.robotframework.org/t/log-to-console-and-should-be-equal-issues-in-robot-framework/6663/1 "2024-01-15T17:20:37Z")

</div>

I have below application under test.

 ![image](https://europe1.discourse-cdn.com/flex005/uploads/robotframework1/original/2X/d/d7ae4d2cca43b7a36b93d8e236daa42cc8bb4f83.png)

I am using Selenium2Library-Python-RobotFramework.  
Below is my code where I am fetching the expected price with the help of xpath. For original price I have already set the variables in variable.robot.

```
    ${ExpectedPriceProductAPrice} = Get Text xpath=//span[@id='Price']
    sleep 2
    Log To Console Price is ${ExpectedPriceProductAPrice}
    ${ExpectedPriceProductACount} = Get Text xpath=//span[@id='Count']
    sleep 2
    Log To Console Count is ${ExpectedPriceProductACount}

    should be equal ${ExpectedPriceProductAPrice} ${OriginalPriceProductAPrice}
    should be equal ${ExpectedPriceProductACount} ${OriginalPriceProductACount}
    should be equal ${ExpectedPriceProductBPrice} ${OriginalPriceProductBPrice}
    should be equal ${ExpectedPriceProductBCount} ${OriginalPriceProductBCount}

```

I am facing two issues :

1. Values are not getting log to console.
2. If _ **should be equal** _ is failed for first statement then it is not moving ahead to check all other _ **should be equal** _ conditions

---

<div class="post-metadata">

**Author:** ![HelioGuilherme66](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/helioguilherme66/32/34_2.png) [@HelioGuilherme66](https://forum.robotframework.org/u/HelioGuilherme66)\
**Post date:** [15 January 2024 20:53 UTC](https://forum.robotframework.org/t/log-to-console-and-should-be-equal-issues-in-robot-framework/6663/2 "2024-01-15T20:53:05Z")

</div>

**Should** keywords are strict conditions, they will stop test execution and mark the test failed, as soon it fails.

For you case, you _should_ collect each assertion and only fail in the end (or just report the results).  
You can use at least three different techniques:

- `${result_1}= Set Variable ${ExpectedPriceProductAPrice} == ${OriginalPriceProductAPrice}`
- `${var_2} ${result_2}= Run Keyword and Ignore Error Should Be Equal ${ExpectedPriceProductACount} ${OriginalPriceProductACount}`
- 

```python
     IF ${ExpectedPriceProductBPrice} == ${OriginalPriceProductBPrice}
         ${result}= Set Variable ${True}
     END # just an example, in this case is better Set Variable If

```

You can create a list or dictionary and append results to it. You could use a loop, and variables with a dynamic name…
