# How to assert on page titles when crawling

**URL:** <https://forum.robotframework.org/t/how-to-assert-on-page-titles-when-crawling/6633>\
**Category:** Browser\
**Created:** [10 January 2024 08:12 UTC](https://forum.robotframework.org/t/how-to-assert-on-page-titles-when-crawling/6633 "2024-01-10T08:12:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![balaji](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/balaji/32/3326_2.png) [@balaji](https://forum.robotframework.org/u/balaji)\
**Post date:** [10 January 2024 08:12 UTC](https://forum.robotframework.org/t/how-to-assert-on-page-titles-when-crawling/6633/1 "2024-01-10T08:12:00Z")

</div>

I am a newbie to robot framework. I am experimenting with the Browser library to test contents of all pages in a given website. I used the `Crawl Site` functionality of the library and that works without issues. Now I am trying to test if the page title of the page being crawled does not contain the string ‘Page not found’. I do the assertion on the page title inside the `page_crawl_keyword` . Here is the code.

> \*\*\* Test Cases \*\*\*  
> Crawl and find errors  
> Crawl Site ${URL}  
> … max\_number\_of\_page\_to\_crawl=2  
> … page\_crawl\_keyword=test\_page
> 
> \*\*\* Keywords \*\*\*  
> test\_page  
> ${title}= Get Title  
> Log to Console Title of page crawled is ${title}  
> Should Not Contain ${title} ‘Page not found’

This assertion does not seem to work. Are assertions expected to work within the `page_crawl_keyword`?

---

<div class="post-metadata">

**Author:** ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)\
**Post date:** [10 January 2024 12:58 UTC](https://forum.robotframework.org/t/how-to-assert-on-page-titles-when-crawling/6633/2 "2024-01-10T12:58:25Z")

</div>

Hi Balaji,

```python
Should Not Contain ${title} ‘Page not found’

```

This is checking that the title does not contain `‘Page not found’` (including the single quotes) not `Page not found` (without the single quotes) as I think you expected, if so what you want is:

```python
Should Not Contain ${title} Page not found

```

Dave.

---

<div class="post-metadata">

**Author:** ![balaji](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/balaji/32/3326_2.png) [@balaji](https://forum.robotframework.org/u/balaji)\
**Post date:** [10 January 2024 13:51 UTC](https://forum.robotframework.org/t/how-to-assert-on-page-titles-when-crawling/6633/3 "2024-01-10T13:51:43Z")

</div>

That was it. Thanks 🙂 I still need to get used to not using quotes for strings 😉
