In CodeceptJs, you have different way to select elements and manipulate them for e2e testing :
But I have some questions about their performance. Which are the best locator type ? What is the ratio between them ? Currently, I use Locator builder but I don't know if they're efficient like CSS selector or ID selector.
There are no performance metrics between type of locators for CodeceptJS, AFAIK.
About locator types
Locator builder just creates xpath locator.
CSS and xpath locator's has similar logic for helpers (WebDriver, Puppeteer, Playwright, etc). Difference in speed appears in browser Driver level.
AFAIK, IE11 with WebDriver works faster with xpath, but Chrome and Firefox with css. For Nightmare, for Puppeteer and others it may differ.
For semantic locators - it depends on type of locator. It tries to find element with one strategy, than with others. So, technically, there are high probability, that semantic locators will be slower.
CodeceptJS tip
And I don't know how really do you need performance tricks, but I know one tip (works for current and older versions, for <= 2.5.0):
If you specify type of selector, like I.click({ css: "button#some-selector" });
, it will be a bit faster, than use of none specified selector I.click("button#some-selector")
due to implementation of semantic (fuzzy) locators.
For non described locator type, Codecept will try to "guess" what type of locator do you use, and, in some cases, it will run same as semantic locator - with search a couple of times with different strategies.
UPD added info about locator types