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
![Значок "Проверено сообществом"](denied:data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAQAAAAngNWGAAABDUlEQVR4AYXRgUZDYRjH4TegFTKgpEqiFJgoWAoMEQGBgBboChaaAKxLKAhAhQqAdAmpBIQolkCFqp2nITvNKXuA7+/Hhzey5OWjE4Nq3rzY1f9/NGHPB549492+8Ww060iCS2XdctZdI3GsECmb+HJoIX6x6EgDm+lURTH+YB7V9nAqE5WNme4YKuOiY6iMe6PaQxUUIuTbswgFVNJwA8sO3Bn6yR6bWZMSNtJwDtuWfHpQxaPx9C9zadil7jrCigbq6UXceNIVKTWUIqypm2ytJdTiNyNeXclF6GttOVfeDEc7qzjR23r3OMFqZKng1kw0mXGLrfibHTScOZWgGv9TdC6ROFeMTgwYiIxvJzMRWQbeGZUAAAAASUVORK5CYII=)
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}')