How can I change an attribute value in the DOM using Selenium and Python

后端 未结 2 659
名媛妹妹
名媛妹妹 2021-01-20 10:05

I\'m trying to navigate through a website using Python and Selenium and I\'ve run into an issue that I can\'t figure out how to solve (assuming it\'s even possible!)

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-20 10:47

    dimension = image.size['width'] * image.size['height']
    driver.execute_script('arguments[0].setAttribute("dimension","{}");'.format(dimension), image)
    

提交回复
热议问题