Some changes must be made to your code for it to work, come on!
login(self)
driver = self.driver
driver.get("https://www.instagram.com.br")
First point to note is that in the "login" function after closing parentheses you should add ":" (two points), otherwise we will have a syntax error.
Then I’d stay that way:
login(self):
Another point to note is code indentation in the login function. Python requires a standardized indentation. The misuse, will result in non-execution, or else in the general malfunction of the program. Correcting would be like this
login(self):
driver = self.driver
driver.get("https://www.instagram.com.br")
I’ll leave you a hint, too. In the login function you would not need to assign the "self.driver" to a variable called "driver" because, just above in the constructor def __init __ you have already created it. The reserved word self serves for you to refer to the object itself(instance) and just leave the code in this way:
login(self):
self.driver.get("https://www.instagram.com.br")
And this way you can even reuse "better" your driver in all parts of the program.
Sorry I didn’t get a good look
– Edésio José
What is the error message?
– Augusto Vasques
File "c: Users paulo Desktop Igbot igBot.py", line 12 def login(self) Syntaxerror: invalid syntax
– Edésio José
You missed two stitches
:
after the declaration. It should look like thisdef login(self):
– Augusto Vasques
Increase the recoil of statements
driver = self.driver
anddriver.get("https://www.instagram.com.br")
. Python is indentation sensitive.– Augusto Vasques
thank you I will test our do not know how I forgot the two points kkkkkk
– Edésio José
It worked out thanks
– Edésio José