I'm getting: "TypeError: 'str' object is not callable" when I execute this code:
iframe=driver.find_element(By.XPATH("//iframe[contains(@src,'https://pianomarvel.com/uploads/editSlicings/85810')]"));
Why?
What is the correct syntax?
Thanks
I tried
iframe=driver.find_element(By.XPATH("//iframe[contains(@src,'https://pianomarvel.com/uploads/editSlicings/85810')]"));
I was expecting it to return an iframe, but instead it returned an error.
I'm trying to identify an iframe. I have two iframes they are both the same class. They have differing src, so I wanted to identify them that way
CodePudding user response:
The proper way of doing this would be:
xpath
should be in small case
iframe=driver.find_element(By.xpath("//iframe[contains(@src,'https://pianomarvel.com/uploads/editSlicings/85810')]"));
OR
iframe = driver.find_element_by_xpath("//iframe[contains(@src,'https://pianomarvel.com/uploads/editSlicings/85810')]")
CodePudding user response:
You have several syntax errors in this line iframe=driver.find_element(By.XPATH("//iframe[contains(@src,'https://pianomarvel.com/uploads/editSlicings/85810')]"));
Try this instead:
iframe=driver.find_element(By.XPATH,"//iframe[contains(@src,'https://pianomarvel.com/uploads/editSlicings/85810')]")