0

This is code with the error. IDE: Eclipse

image


EDIT: I used addArguments but the error still there,

image

Youssef13
  • 3,836
  • 3
  • 24
  • 41
  • Does this answer your question? [Run chrome browser in inconginto Mode in Selenium](https://stackoverflow.com/questions/19026295/run-chrome-browser-in-inconginto-mode-in-selenium) – Mohsen_Fatemi Jul 04 '20 at 20:52
  • Thanks for your suggestion @Mohsen_Fatemi the issue is still happening – notPercival Jul 04 '20 at 20:58
  • 2
    Your code is outside of a method. You cannot have statement like this outside of a method, constructor or (static) initializer. – Mark Rotteveel Jul 05 '20 at 09:56
  • LOL I just realized that, sorry for the stupid situation, thank you: EDIT: Can I choose your answer as the correct one? well this is a comment....so – notPercival Jul 05 '20 at 18:26

2 Answers2

1

Based on the documentation, the method name should be addArguments not AddArgument. By the way, Java uses camelCase for methods by convention. The code you currently have is a correct C# code, so it seems that you've copied a C# snippet from somewhere.

If the error still exists, try clean & rebuilding the project or restarting the IDE and/or your PC. It might be that "Eclipse" just have some weird problem.

Youssef13
  • 3,836
  • 3
  • 24
  • 41
0

You wrote the name of the function incorrectly, it is options.addArguments("--incognito");

Mohsen_Fatemi
  • 2,183
  • 2
  • 16
  • 25