鼠标时使用Xpath选择图的元素

2024-09-27 00:17:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用seleniumxpath从Semrush获取数据。你知道吗

此时,我想选择一个标签,它只在鼠标位于条形图上方时显示。 关键是,当鼠标移到每个条的上方时,图形的标签刚好向上。你知道吗

我想要条形图的每个值。 我使用selenium KDE选择链接,但它不起作用:

elements = driver.find_elements_by_xpath("//div[@id='highcharts-26']/div/span/a") #grab that stuff you wanted?  

lista=[]

for e in elements:
    lista.append(e.get_attribute('class').strip()) #print text fields

dados[i]=lista
str1 = ''.join(lista)
websites.loc[websites['URL']==i,'1 a 3']=str1
print('keywords 1 a 3' + str1)      

有人能帮我吗?你知道吗


Tags: div图形selenium标签elements鼠标关键websites

热门问题