Script for page to get is
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium.webdriver.support import expected_conditions as EC
import unittest
import time, re, castro
class LoginTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.PhantomJS()
self.driver.maximize_window()
self.driver.get("xxx.html") # getting the page
"wanna wait her"
print self.driver.save_screenshot("fire.png")
def tearDown(self):
self.driver.quit()
if __name__ == '__main__' :
unittest.main()
HTML Code for iframe
:
<body>
<iframe src="http://thunder/spidio.net/CF9F4DA6B7533431/devinfo/devdect /d,,,_STN&pg=Post=&ckid=null&ord=123&p=mts&cid=0&pid=124" style="background-color: transparent; border : 0px none transparent; padding: 0px; overflow: hidden;" height="1" width"1">
</iframe>
</body>
please let me know how to make selenium wait for this iframe to be loaded in phantomjs with selenium using python
WebDriverWait wait = new WebDriverWait(driver,10); wait. until(ExpectedConditions. frameToBeAvailableAndSwitchToIt(frameName); The above code will wait for a given frame up to 10 seconds .
You can use below code to wait until required iframe
appears:
WebDriverWait(self.driver, 10).until(EC.presence_of_element_located((By.XPATH, "//iframe[starts-with(@src, 'http://thunder/spidio.net/CF9F4DA6B7533431/devinfo/devdect')]")))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With