Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛 Bug]: Documentation test example - Severity 4 #13369

Closed
thecircleoflifefree opened this issue Dec 29, 2023 · 7 comments
Closed

[🐛 Bug]: Documentation test example - Severity 4 #13369

thecircleoflifefree opened this issue Dec 29, 2023 · 7 comments

Comments

@thecircleoflifefree
Copy link

What happened?

On the following link:
example

This code will not run:

`const {Builder, By, Key, until} = require('selenium-webdriver');

(async function example() {
let driver = await new Builder().forBrowser('firefox').build();
try {
await driver.get('http://www.google.com/ncr');
await driver.findElement(By.name('q'));.sendKeys('webdriver', Key.RETURN);
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
} finally {
await driver.quit();
}
})();`

Line 7 will return:
SyntaxError: Unexpected token '.'

FIX

Remove ';' to use the sendKeys method accordingly.

How can we reproduce the issue?

Copy/Paste the code as given on the website and test.

Relevant log output

testfile.js:7
    await driver.findElement(By.name('q'));.sendKeys('webdriver', Key.RETURN);
                                           ^

SyntaxError: Unexpected token '.'
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.10.0

Operating System

NA

Selenium version

node

What are the browser(s) and version(s) where you see this issue?

NA

What are the browser driver(s) and version(s) where you see this issue?

NA

Are you using Selenium Grid?

NA

Copy link

@thecircleoflifefree, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

@titusfortner
Copy link
Member

Those api documents are out of date and we can't fix them #10185
@diemol can we just remove what is there now to avoid confusion?

@thecircleoflifefree just remove the semicolon before the period,or doesn't belong there.

Check out the examples in our website https://www.selenium.dev/documentation/webdriver/getting_started/?tab=javascript

@titusfortner titusfortner closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2023
@diemol
Copy link
Member

diemol commented Dec 29, 2023

Sure, we should remove them.

@titusfortner
Copy link
Member

Lol, and I did extra work on the build automaton to not overwrite them.

@diemol
Copy link
Member

diemol commented Dec 30, 2023

I mean, I have the JS docs in my TODO list, I can then work on it so you do not need to modify your scripts.

@titusfortner
Copy link
Member

Current scripts work either way, just have more lines of code. 😄

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants