user14809494
user14809494

Reputation:

Li is not clickable at this point

So I'm using selenium in order to fetch stats from a brawlhalla website. I'm running into an error on the "weapon4_click.click" saying ("element click intercepted: Element ... is not clickable at point (151, 848). Other element would receive the click: ...") Everything printed but the error is only being raised for that line. Here is the code:

import selenium
from selenium import webdriver
from selenium.webdriver.remote.webdriver import WebDriver 
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By

PATH = 'C:\Program Files (x86)\chromedriver.exe'

web = webdriver.Chrome(PATH)

Brawl_Name1 = ('ufrz')

website = web.get('https://tracker.gg/brawlhalla')

steam = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[1]/div[1]/div/div/div[1]/div[2]/div[1]/ul/li[2]')
steam.click()

search = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[1]/div[1]/div/div/div[1]/div[2]/div[1]/form/input')
search.click()
search.send_keys(Brawl_Name1)
search.send_keys(Keys.ENTER)

legend_find = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[1]/div[3]/ul/li[2]/a')))
legend_find.click()

Highest_Legend = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[2]/div[1]/div[1]')))
print(Highest_Legend.text)

weapon_dropdown = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/div')))
weapon_dropdown.click()

weapon1_click = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/ul/li[1]')
weapon1_click.click()

Highest_Hammer = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[2]/div[1]/div[1]')
print(Highest_Hammer.text)

weapon2_dropdown = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/div')))
weapon2_dropdown.click()

weapon2_click = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/ul/li[2]')
weapon2_click.click()

Highest_Sword = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[2]/div[1]/div[1]')
print(Highest_Sword.text)

weapon3_dropdown = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/div')))
weapon3_dropdown.click()

weapon3_click = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/ul/li[3]')
weapon3_click.click()

Highest_Blasters = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[2]/div[1]/div[1]')
print(Highest_Blasters.text)

weapon4_dropdown = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/div')))
weapon4_dropdown.click()

weapon4_click = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.XPATH,'//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[1]/div/ul/li[4]')))
weapon4_click.click()

Highest_Lance = web.find_element_by_xpath('//*[@id="app"]/div[2]/div[2]/div/main/div[2]/div[3]/div[1]/div[2]/div[1]/div[1]')
print(Highest_Lance.text)

Upvotes: 0

Views: 130

Answers (2)

vitaliis
vitaliis

Reputation: 4212

All your locators need to be improved. But exactly this one needs to be changed to: 1 CSS: .filters.responsive .dropdown or .filters.responsive .dropdown>.dropdown__selected, or just .dropdown__selected.

weapon4_click = WebDriverWait(web, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,'.filters.responsive .dropdown')))
weapon4_click.click()

. is for class name, > for a direct child.

2 Or xpath:

//div[@class='dropdown__selected']

You can try reworking your locators strategy in accordance with my suggestions. Check here for xpath syntax and here for css.

Upvotes: 1

Prophet
Prophet

Reputation: 33361

As I see from your code you opening and closing the drop-down dialog there several times, so the problem is when you trying to perform weapon4_click.click your drop-down dialog is actually closed so you trying to click on element that is not currently visible.
Also, as mentioned by vitaliis you should use better locators

Upvotes: 1

Related Questions