Five newbie questions (identifying locators, VS Code extensions, best practices, pipeline integration)

Hi there

In my team we were exploring various test automation tools and ended up trying out Playwright and Robot Framework Browser Library (RFB). We decided to go with the latter. Since I was the one exploring Playwright and my colleague did RFB, I’m now learning RFB myself.

Coming from Playwright and its VS Code extension, one immediate question arose for me:
[Q01] What’s the best practice for identifying locators when working with RFB? With the Playwright VS Code code extension, in the testing tab, I can hit the Record new button, a browser launches in element selection mode and I can simply click, type etc. while perfectly valid Playwright Typescript code is recorded in my new test file. It’s an extremely smooth process. A logical workaround is using the Playwright extension’s “Pick locator” feature and then copy-pasting into my .robot file but that quite hacky.

[Q02] Does RFB have anything like this? The section titled “Finding Elements” in the docs mentions nothing of the sort.

[Q03] Is there an official RFB VS Code extension?

I found these two and am playing with both to see what’s most helpful. It seems there’s a lot of overlap in functionality between the two:

I like the idea of the keywords.resource file to make the file containing the test cases even cleaner to read. [Q04] Can RBF be configured to optimise test suite structure, such as actually creating a keywords.resource file and putting the whole *** Keywords *** section in case that’s present in my .robot file?

[Q05] Much more importantly, once I get the hang of this on my Mac, what’s the easiest way to get this truly automated in, say, a Gitlab pipeline? Asked differently, what needs to happen for my local test code to successfully execute in a Gitlab pipeline?

Thanks for reading this far and have a fantastic day!

Hi Ismar,

My first tip would be to create seperate posts for unrelated questions, simply because people who have the knowledge to answer one question may not know anything about another. It’s not a requirement to do this, just more likely you’ll get better answers.

I’ll try my best to answer to give you some answers:

[Q01] (part a) I don’t believe there is a “practice for identifying locators”, there are several methods supported, and all supported methods are acceptable in the RF community. RF seems to be about providing flexibility and does a good job at this.

You may want to set a standard for consistency for your company, but in doing this you may end up limiting yourselves, so I would suggest you set your standard to prioritise the order the selector type is chosen rather than limit to one type.

[Q01] (part b) + [Q02] There is no formal or central “recorder” type tool for Robot Framework, but in the documentation for some libraries there will be mention of tools that might help (flaui Library is a good example).
Also there are some chrome extensions that record .robot files for Selenium Library, I’ve used Robotcorder (source) before and it was quite good but hasn’t been maintained for a while, there’s a fork here Robocorp Recorder, and also there’s another similar tool Chrome Robot but i’ve not tried either of them.
You might also find something similar to record .robot files for Browser Library, i’ve not seen one but haven’t really looked either.

[Q03] Official VS Code extension? no and there probably won’t be. Again with the flexibility, you are free to choose any editor or IDE you want, rather than being limited to the editor that’s preferred by the developer. Those extensions are developed by people who use VS Code and Robot Framework, so I would argue that they are probably better supported than if the RF developers had to maintain Official extensions for every editor and every library. I don’t know much about it but saw some mentions in this forum of a language standard that the Libraries help files and syntax highlighting / code completion tools use so the extensions can still handle RF libraries that the extension was never tested with.
I don’t use VS Code myself, but hopefully that answers your question.

[Q04] The ability to create a test structure of keyword libraries is part of the fundamental core of Robot Framework, so all Robot Framework Libraries (including Browser Library) have this ability. I gave what I believe was a good generic example on how you can do this in the link below:

[Q05] My understanding of this, i’ve not done this with Gitlab, but with Github which is similar.

  1. check your .robot file/library of tests and keywords into git (you probably already did this?)
  2. choose / setup a template machine with the required Robot Framework Libraries and dependancies. I know there are docker templates like this you could use but if you want a different type of image search and see if someone already built one you can use
  3. configure you pipeline to launch a vm/container using the template and run the robot framework test case. Configure Gitlab to run on check in, merge or whatever trigger you want to use. You’ll need to refer to Gitlab documentation or some online tutorials for this bit)

Then simply make a small change (add a space, tab or comment) and check it in to trigger the pipeline workflow and check it works as you expected.

Hopefully those answers will guide you in the right direction,

Dave.

Hi @damies13

Many thanks for your detailed answer!

I very much appreciate you’re tip. You’re absolutely right. My post was a bit too large. I’ll remember that.

Q01/02: Got it. I’ll look into those recorders and extensions.
Q03: Ok, thank you. I’ll just test out what works best for us and stick with it.
Q04: Thanks again, I will look into your linked post.
Q05: That sounds like a great starting point, thanks. My colleague also found this, which looks promising: to be continuous... / Robot Framework · GitLab.

Thanks very much for your time and effort. I appreciate it.

Cheers!

1 Like

Side note: is editing disabled in this forum? I keep wanting to fix typos in my posts but can’t.

1 Like

Hi Ismar,

Editing is available by clicking the pencil button Screenshot 2023-01-21 at 1.11.13 am, at least for me.

It might be disabled until you’ve reached basic trust level, not sure. There was an issue with spam a last year where the spammer would create a new account, reply to a thread with a genuine-ish sounding reply wait an hour and then edit their reply with their spam message and so blocking editing for new users might have been the fix to block that?

Reaching [basic trust level] is not hard just stick around and read some threads (you might pick up some useful tips along the way) and ask questions as you get stuck, and help people if you can.

Dave.

3 Likes

Makes perfect sense, @damies13 ! Many thanks again :slight_smile:

And suddenly, I can edit :slight_smile: .

1 Like