F
F
Flaidy2022-01-09 05:35:54
Python
Flaidy, 2022-01-09 05:35:54

How to solve "'str' object is not callable" error?

I made a bot for a site that first of all should log into the account by clicking on the button, but when I wrote down what I want and ran the code, I got an error: 'str' object is not callable

I want the button to be clicked

Here is my code:

from selenium import webdriver
import time
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

url = "https://omlet.gg/stream/iromanenkov"

# Указываем абсолютный путь до хромдрайвера
driver = webdriver.Chrome(executable_path=r"C:\Users\namva\PycharmProjects\seleniumlessons\chromedriver\chromedriver.exe")

try:
    driver.get("https://omlet.gg/stream/iromanenkov")
    time.sleep(5)
    # Логин
    login = driver.find_element(By.CLASS_NAME(" omlet-bar-login-button")).click()
    time.sleep(5)



except Exception as ex:
    print(ex)
finally:
    driver.close()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2022-01-09
@SoreMix

By.CLASS_NAME
- not a function.
login = driver.find_element(By.CLASS_NAME, «omlet-bar-login-button»)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question