Selenium:无法用Python获得元素的正确坐标

2024-10-03 17:28:27 发布

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

url = 'https://golestan.kntu.ac.ir/home/balancer/balancer.aspx?vv=2&cost=main'
driver = webdriver.Chrome(executable_path = "G://captcha recognition project//chromedriver.exe")
driver.get(url)
driver.set_window_size(1920, 1080)
element = driver.find_element_by_xpath('//*[@id="tblCap"]/tbody/tr[1]/td[3]/img')
location = element.location
size = element.size

返回正确的大小,但坐标不准确 例如,正确的坐标是1100&600 但是产量是900&500 有什么解决办法吗?????你知道吗


Tags: httpsurlhomesizeirdriverlocationelement