我需要点击一个按钮,如果它的颜色是“139,140,199”,我已经尝试过Pyatogui,但从来没有工作过,我可以用selnium吗
def mute_cam(self):
time.sleep(3)
cam_xpath = '/html/body/div[2]/div[2]/div[2]/div[1]/div/calling-pre-join-screen/div/div/div[2]/div[1]/div[2]/div/div/section/div[2]/toggle-button[1]/div/button/span[1]'
self.rgb = driver.find_element_by_xpath(cam_xpath).value_of_css_property('background')
list = [self.rgb]
str_list = str(self.rgb)
new_list = str_list[4:17]
print(new_list)
我曾尝试将颜色存储在一个列表中,然后进行比较,但问题是我不知道怎么做
您可以通过Javascript或使用
.value_of_css_property
在Selenium中获得元素的任何CSS属性下面是获取引导文档page上的按钮列表并获取其
background-color
的示例上述代码的输出为:
相关问题 更多 >
编程相关推荐