<% if (it.hasDocusaurusHeader) { %> --- id: <%= it.command %> title: <%= it.command %> <% if (it.customEditUrl) { %>custom_edit_url: <%= it.customEditUrl %><% } %> --- <% } else if (it.hasHeader) { %> ## <%= it.command %> <% } %> <%= it.description %> <% if (it.deprecated) { %> :::caution <%= it.deprecated %> ::: <% } %> <% if (it.alternativeCommands && it.alternativeCommands.length) { %> :::info This protocol command is embedded in the following convenient method<%= it.alternativeCommands.length > 1 ? 's' : '' %>: <%= it.alternativeCommands.map((command) => `[${command.split('/').pop()}](/docs/api/${command})`).join(', ') %>. It is recommended to use <%= it.alternativeCommands.length > 1 ? 'these commands' : 'this command' %> instead. ::: <% } %> <% if (!it.isSkipUsage) { %> ##### Usage ```js <% if (it.isElementScope) { %> $(selector).<%= it.command %>(<%= it.paramString %>) <% } else if (it.isMockScope) { %> mock.<%= it.command %>(<%= it.paramString %>) <% } else if (it.isDialogScope) { %> await dialog.<%= it.command %>(<%= it.paramString %>) <% } else if (it.isClockScope) { %> const clock = await browser.emulate('clock', { ... }) await clock.<%= it.command %>(<%= it.paramString %>) <% } else { %> <%= it.isMobile ? 'driver' : 'browser' %>.<%= it.command %>(<%= it.paramString %>) <% } %> ``` <% } %> <% if (it.paramTags.length) { %> ##### Parameters <% it.paramTags.forEach((paramTag) => { %> <% if (paramTag.tag === "rowInfo") { %> <% if (paramTag.string.includes('::')) { %> <% const parts = paramTag.string.split('::').map(part => part.trim()); %> <% } else { %> <% } %> <% } else { %> <% } %> <% }) %>
NameTypeDetails
<%= parts[0] %>
<%= parts[1] %>
<%= paramTag.string %>
<%= paramTag.name + (paramTag.default ? `=${paramTag.default}` : '') %><% if ((!paramTag.required && typeof paramTag.optional === 'undefined') || paramTag.optional) { %>
optional<% } %>
<%= paramTag.type.split('|').join(', ').replace('(', '').replace(')', '') %> <%= paramTag.description %>
<% } %> <% const allExamples = [...it.examples, ...it.exampleReferences]; if (allExamples.length) { %> ##### Example<%= allExamples.length > 1 ? 's' : '' %> <% it.exampleReferences.forEach(function(ref) { const filename = it.path.basename(ref.split('#')[0]); const ext = it.path.extname(filename).slice(1); %> ```<%= ext %> reference title="<%= filename %>" useHTTPS <%= ref %> ``` <% }); %> <% it.examples.forEach(function(example) { %> ```<%= example.format %><% if (example.file) { %> title="<%= example.file %>"<%}%> <% = example.code %> ``` <% }); %> <% } %> <% if (it.returns) { %> ##### Returns - **<<%= it.returns.type %>>** <% if (it.returns.description) { %> **<%= it.returns.name %>:** <%= it.returns.description %> <% } %> <% } %> <% if (it.throwsTags.length) { %> ##### Throws <% it.throwsTags.forEach(function(throwsTag) { %>- **<%= throwsTag.type %>**: <%= throwsTag.description %><% }) %> <% } %> <% if (it.support && Object.keys(it.support).length) { %> ##### Support <% Object.keys(it.support).forEach(function(platform) { %> ![Support for <%= Object.keys(it.support[platform]).map(function(driver) { return driver + " (" + it.support[platform][driver] + ")"; }).join(", ") %>](/img/icons/<%= platform %>.svg) <% }) %> <% } %>