# BrowserStack - "No keyword with name 'Get Confirmation Code' found." - Custom Keyword

**URL:** <https://forum.robotframework.org/t/browserstack-no-keyword-with-name-get-confirmation-code-found-custom-keyword/7644>\
**Category:** Robot Framework\
**Created:** [31 July 2024 20:58 UTC](https://forum.robotframework.org/t/browserstack-no-keyword-with-name-get-confirmation-code-found-custom-keyword/7644 "2024-07-31T20:58:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matheusAndrade](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@matheusAndrade](https://forum.robotframework.org/u/matheusAndrade)\
**Post date:** [31 July 2024 20:58 UTC](https://forum.robotframework.org/t/browserstack-no-keyword-with-name-get-confirmation-code-found-custom-keyword/7644/1 "2024-07-31T20:58:20Z")

</div>

Hi, I have a scenario where I use a custom keyword.

I can run the scenarios locally and its always working.

The problem is when I try to run on BrowserStack, when its time to run the keyword, I got the error message No keyword with name ‘Get Confirmation Code’ found."

/// THE KEYWORD  
from imap\_tools import MailBox  
import re  
import time  
from robot.api.deco import keyword

@keyword  
def get\_confirmation\_code():  
username = “xxxxxxx”  
password = “xxxxxxxx”  
imap\_server = “[imap.fastmail.com](http://imap.fastmail.com)”

```
pattern = r'\b\d{6}\b'
attempts = 12  
delay = 15  

for attempt in range(attempts):
    with MailBox(imap_server).login(username, password, "Inbox") as mb:
        for msg in mb.fetch(criteria='UNSEEN', limit=5, reverse=True, mark_seen=True):
            if msg.from_ == "xxxxxxx":
                match = re.search(pattern, msg.text)
                if match:
                    return match.group()
            
        print(f"No new emails found, attempt {attempt + 1}/{attempts}. Waiting for {delay} seconds.")
        time.sleep(delay) # Wait before the next attempt
return None

```

///THE STEP

I login into the app

```
Click Text Start now
Input Text Into Current Element ${userEmail}
 Click Element xpath=${loginPageSendEmailButton}
 Sleep 5
 ${code}= Run Keyword Get Confirmation Code. <-------

```

/// How Im importing it  
\*\*\* Settings \*\*\*

Library AppiumLibrary  
Library ${CURDIR}/…/helper/email/emailReader.py \<----

Keep in mind that it is working fine on appium local, the problem is when I try to use BrowserStack

---

<div class="post-metadata">

**Author:** ![CharlieScene](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/charliescene/32/3484_2.png) [@CharlieScene](https://forum.robotframework.org/u/CharlieScene)\
**Post date:** [1 August 2024 05:35 UTC](https://forum.robotframework.org/t/browserstack-no-keyword-with-name-get-confirmation-code-found-custom-keyword/7644/2 "2024-08-01T05:35:45Z")

</div>

Hi,

I have no knowledge on running in browserstack, but when using custom keyword I define them this way with their name:

```
@keyword("Open Mailbox")
 def openmailbox(user,password):

```

Also I already had issues with ${CURDIR}, which was not the one I expected (in docker for example).  
So maybe try importing with EXECDIR  
Try adding these folders Log info to check what exactly made (and are there any library import warning?)

Regards  
Charlie
