0
我正在使用我的旧工具(HP QTP)测试过的应用程序,现在我需要将它转换为硒(python webdriver),我遇到了问题特定的部分,在测试流程期间,我接收具有该值的图像(数据仅用于测试而为静态),因此我知道应该发送什么值作为响应。 在HP QTP我解决了它的“如果有条件”和环形(以下VB代码):Selenium,从图像对象检索url问题
For Each elem As HtmlElement In WebBrowser1.Document.GetElementsByTagName("img")
If elem.GetAttribute("src") = "http://URL/image_1.png" Then
WebBrowser1.Document.GetElementById("response").SetAttribute("value", "70")
End If
If elem.GetAttribute("src") = "http://URL/image_2.png" Then
WebBrowser1.Document.GetElementById("response").SetAttribute("value", "80")
End If
我不知道应该如何看起来蟒。我没有在Python中找到“elem.GetAttribute(”“)”的等价函数。 不幸的是,我缺乏Python的经验,所以我正在寻找解决方案或提示这个问题。