AttributeError str object has no attribute click

0 votes
Hey guys. i need help! 

I have a bot but it gives an error


Traceback (most recent call last):
  File "/Volumes/ILYA/bot/MBbot2.py", line 121, in <module>
    getAuctionPage()
  File "/Volumes/ILYA/bot/MBbot2.py", line 25, in getAuctionPage
    driver.find_element_by_xpath, ('/html/body/div[1]/div/div[2]/main/div/div[2]/div[1]/div[2]/div[4]/div[3]/div[1]/button').click() #buy btn
AttributeError: 'str' object has no attribute 'click'





I don’t understand how to fix it. here is the code itself

import requests
import json
import time
from datetime import datetime
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from seleniumwire import webdriver
import asyncio
import aiohttp
from MBbot2Config import *
    

headers = {}

def getAuctionPage():
    

    url = f'https://www.binance.com/ru/nft/goods/detail?productId={productIdToAuction}&isOpen=true&isProduct=1'
    driver.get(url)
    time.sleep(2)
    
    driver.find_element_by_xpath, ('/html/body/div[1]/div/div[2]/main/div/div[2]/div[1]/div[2]/div[4]/div[3]/div[1]/button').click() #buy btn

    print ("CLICKED")

def clickConfirm(headers):

    search = driver.find_element_by_xpath, ('/html/body/div[4]/div/div[2]/button')
    ActionChains(driver).move_to_element(search).click().perform()

    print ("CLICKED")

    time.sleep(3)
    
    
I did not insert part of the code here



Значок "Проверено сообществом"

    
getAuctionPage()

print('hi')

rqStart = 0
rqStop = 0
while True:
    ts = time.time()
    if saleTime>ts:
        print(f'{saleTime-ts} - осталось секунд')
    if saleTime-ts < 7.0:
        break
rqStart=time.time()

headers = clickConfirm({})

while True:
    ts = time.time()
    if saleTime>ts:
        print(f'{saleTime-ts} - осталось секунд')
    if saleTime<ts:
        startSsc(headers)
        break
        

# while True:
#     ts = time.time()
#     saleTime = 1632227100-0.3
#     if saleTime>ts:  
#         print(f'{saleTime-ts} - осталось секунд')
#     else:
#         headers = clickConfirm({})
#         break

# print(headers)
# startSsc(headers)

rqStop = time.time()
for r in results:
    if len(r)>250:
        print('blocked')
    else:
        print(r)

print(f'{rqStart - rqStop}')
Nov 8 in Python by anonymous
• 120 points
5 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
1 answer

Python error "AttributeError: 'str' object has no attribute 'casefold'"

Check your python version. Casefold is possible ...READ MORE

answered Jul 4, 2019 in Python by Yesha
4,001 views
0 votes
1 answer

Getting AttributeError: 'module' object (scipy) has no attribute 'misc' in Python. How to solve this?

>>> import scipy >>> scipy.misc Traceback (most recent call ...READ MORE

answered Dec 24, 2018 in Python by Nymeria
• 3,540 points
6,731 views
0 votes
1 answer
0 votes
2 answers

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

Try this: data=pd.read_csv('/your file name', delim_whitespace=Tru ...READ MORE

answered Dec 10, 2020 in Python by anonymous
• 82,880 points
83,790 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() ...READ MORE

answered Jun 19, 2019 in Python by Faiza
3,660 views
+1 vote
3 answers

Python error "AttributeError: 'Turtle' object has no attribute 'Shape'"

Hey @Nagya, replace python.Shape("Square") with the following: python.shape("square") Python is case ...READ MORE

answered Jun 19, 2019 in Python by Faiza
16,527 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
6,224 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
6,580 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,890 points
4,207 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
5,211 views