'Selenium 3 compatibility issue with FireFox 50? Can't get any iframe
There are two environments, one is my local with Firefox 47 & Selenium 2.0, the other one is remote vm with Firefox 50 & Selenium 3. With the same code below, the output is different(the newer version doesn't have iframes to switch with). Is my code the problem or there are compatibility issues with the newer version?
switchToLatestWindow(self.browser) worked on both since i checked the current_window_handle
switchToLatestWindow(self.browser)
time.sleep(3)
logger.info("===============================================================================================")
logger.info(self.browser.current_window_handle)
logger.info(self.browser.find_elements_by_tag_name('iframe'))
self.browser.switch_to_frame("WorkAreaFrame1popup")
logger.info("***********************************************************")
logger.info(self.browser.find_elements_by_tag_name('iframe'))
# enter firstName and lastName
result = self.enterFirstName(firstName) and self.enterLastName(lastName)
if not result:
return False
# switch to new windowssss
logger.info(self.browser.find_elements_by_tag_name('iframe'))
switchToLatestWindow(self.browser)
logger.info(self.browser.find_elements_by_tag_name('iframe'))
time.sleep(3)
logger.info("++++++++++++++++++++++++++++++++++++++++++++++++++")
logger.info(self.browser.current_window_handle)
logger.info(self.browser.find_elements_by_tag_name('iframe'))
self.browser.switch_to_frame("WorkAreaFrame1popup")
logger.info("------------------------------------------------------------------")
time.sleep(2)
return result
Here are the outputs Older Version:
INFO:2017-02-06 12:12:49,615; TCID_4196; createClientProspect.py:1119; ===============================================================================================
INFO:2017-02-06 12:12:49,627; TCID_4196; createClientProspect.py:1120; {e0bbf87b-890d-4b4f-91f9-7c85cb4ac736}
INFO:2017-02-06 12:12:49,635; TCID_4196; createClientProspect.py:1121; [<selenium.webdriver.remote.webelement.WebElement (session="60a21376-7577-4c81-ae79-1233564c227a", element="{23eabe2b-9e57-4319-97d2-d7959f302391}")>, <selenium.webdriver.remote.webelement.WebElement (session="60a21376-7577-4c81-ae79-1233564c227a", element="{db69ec0c-58ba-41ba-b1a9-dd4b1feec08a}")>]
INFO:2017-02-06 12:12:49,644; TCID_4196; createClientProspect.py:1123; ***********************************************************
INFO:2017-02-06 12:12:49,653; TCID_4196; createClientProspect.py:1124; []
INFO:2017-02-06 12:12:49,654; TCID_4196; common_utils.py:339; Randomly generated name:Cagmysp
INFO:2017-02-06 12:12:49,654; TCID_4196; api.py:58; Entering 'Cagmysp' on object named First Name on page New Profile
INFO:2017-02-06 12:12:49,654; TCID_4196; api.py:114; Inject Args: input[id$='builheader_struct.firstname'] to input[id$='builheader_struct.firstname']
INFO:2017-02-06 12:12:50,746; TCID_4196; api.py:142; Successfully interacted with object First Name
INFO:2017-02-06 12:12:50,746; TCID_4196; actionBase.py:103; [PASS] Successfully Entered First Name: Cagmysp
INFO:2017-02-06 12:12:50,746; TCID_4196; common_utils.py:339; Randomly generated name:Bnzpnkbjst
INFO:2017-02-06 12:12:50,746; TCID_4196; api.py:58; Entering 'Bnzpnkbjst' on object named Last Name on page New Profile
INFO:2017-02-06 12:12:50,746; TCID_4196; api.py:114; Inject Args: input[id$='builheader_struct.lastname'] to input[id$='builheader_struct.lastname']
INFO:2017-02-06 12:12:51,872; TCID_4196; api.py:142; Successfully interacted with object Last Name
INFO:2017-02-06 12:12:51,872; TCID_4196; actionBase.py:103; [PASS] Successfully Entered Client Last Name: Bnzpnkbjst
INFO:2017-02-06 12:12:51,881; TCID_4196; createClientProspect.py:1131; []
INFO:2017-02-06 12:12:51,890; TCID_4196; common_utils.py:188; Number of window handles: 2
INFO:2017-02-06 12:12:51,890; TCID_4196; common_utils.py:189; Number of window handles: [u'{3f63d3c1-642f-4e8d-a77b-2136711f94c3}', u'{e0bbf87b-890d-4b4f-91f9-7c85cb4ac736}']
INFO:2017-02-06 12:12:51,894; TCID_4196; common_utils.py:192; Number of window handles: 2
INFO:2017-02-06 12:12:51,894; TCID_4196; common_utils.py:193; Number of window handles: [u'{3f63d3c1-642f-4e8d-a77b-2136711f94c3}', u'{e0bbf87b-890d-4b4f-91f9-7c85cb4ac736}']
INFO:2017-02-06 12:12:51,910; TCID_4196; createClientProspect.py:1134; [<selenium.webdriver.remote.webelement.WebElement (session="60a21376-7577-4c81-ae79-1233564c227a", element="{23eabe2b-9e57-4319-97d2-d7959f302391}")>, <selenium.webdriver.remote.webelement.WebElement (session="60a21376-7577-4c81-ae79-1233564c227a", element="{db69ec0c-58ba-41ba-b1a9-dd4b1feec08a}")>]
INFO:2017-02-06 12:12:59,910; TCID_4196; createClientProspect.py:1136; ++++++++++++++++++++++++++++++++++++++++++++++++++
INFO:2017-02-06 12:12:59,920; TCID_4196; createClientProspect.py:1137; {e0bbf87b-890d-4b4f-91f9-7c85cb4ac736}
INFO:2017-02-06 12:12:59,927; TCID_4196; createClientProspect.py:1138; [<selenium.webdriver.remote.webelement.WebElement (session="60a21376-7577-4c81-ae79-1233564c227a", element="{23eabe2b-9e57-4319-97d2-d7959f302391}")>, <selenium.webdriver.remote.webelement.WebElement (session="60a21376-7577-4c81-ae79-1233564c227a", element="{db69ec0c-58ba-41ba-b1a9-dd4b1feec08a}")>]
INFO:2017-02-06 12:12:59,936; TCID_4196; createClientProspect.py:1140; ------------------------------------------------------------------
Here's the output of newer version:
INFO:2017-02-06 12:17:54,739; TCID_4196; common_utils.py:193; Number of window handles: [u'2147483651', u'2147483678']
INFO:2017-02-06 12:17:57,759; TCID_4196; createClientProspect.py:1119; ===============================================================================================
INFO:2017-02-06 12:17:57,767; TCID_4196; createClientProspect.py:1120; 2147483678
INFO:2017-02-06 12:17:57,782; TCID_4196; createClientProspect.py:1121; [<selenium.webdriver.firefox.webelement.FirefoxWebElement (session="4079af6b-dda2-4949-95c6-8aa9ff29c49e", element="89bfc3a1-5749-42d4-b0db-da1fc43a0f35")>, <selenium.webdriver.firefox.webelement.FirefoxWebElement (session="4079af6b-dda2-4949-95c6-8aa9ff29c49e", element="3483f682-490c-4c16-8055-fb6c0ee99ad0")>]
INFO:2017-02-06 12:17:57,809; TCID_4196; createClientProspect.py:1123; ***********************************************************
INFO:2017-02-06 12:17:57,821; TCID_4196; createClientProspect.py:1124; []
INFO:2017-02-06 12:17:57,821; TCID_4196; common_utils.py:339; Randomly generated name:Odkdzgvbi
INFO:2017-02-06 12:17:57,821; TCID_4196; api.py:58; Entering 'Odkdzgvbi' on object named First Name on page New Profile
INFO:2017-02-06 12:17:57,822; TCID_4196; api.py:114; Inject Args: input[id$='builheader_struct.firstname'] to input[id$='builheader_struct.firstname']
INFO:2017-02-06 12:17:58,928; TCID_4196; api.py:142; Successfully interacted with object First Name
INFO:2017-02-06 12:17:58,928; TCID_4196; actionBase.py:103; [PASS] Successfully Entered First Name: Odkdzgvbi
INFO:2017-02-06 12:17:58,930; TCID_4196; common_utils.py:339; Randomly generated name:Arrtxwyjs
INFO:2017-02-06 12:17:58,930; TCID_4196; api.py:58; Entering 'Arrtxwyjs' on object named Last Name on page New Profile
INFO:2017-02-06 12:17:58,930; TCID_4196; api.py:114; Inject Args: input[id$='builheader_struct.lastname'] to input[id$='builheader_struct.lastname']
INFO:2017-02-06 12:18:00,101; TCID_4196; api.py:142; Successfully interacted with object Last Name
INFO:2017-02-06 12:18:00,101; TCID_4196; actionBase.py:103; [PASS] Successfully Entered Client Last Name: Arrtxwyjs
INFO:2017-02-06 12:18:00,127; TCID_4196; createClientProspect.py:1131; []
INFO:2017-02-06 12:18:00,138; TCID_4196; common_utils.py:188; Number of window handles: 2
INFO:2017-02-06 12:18:00,138; TCID_4196; common_utils.py:189; Number of window handles: [u'2147483651', u'2147483678']
INFO:2017-02-06 12:18:00,148; TCID_4196; common_utils.py:192; Number of window handles: 2
INFO:2017-02-06 12:18:00,148; TCID_4196; common_utils.py:193; Number of window handles: [u'2147483651', u'2147483678']
INFO:2017-02-06 12:18:00,176; TCID_4196; createClientProspect.py:1134; []
INFO:2017-02-06 12:18:08,177; TCID_4196; createClientProspect.py:1136; ++++++++++++++++++++++++++++++++++++++++++++++++++
INFO:2017-02-06 12:18:08,184; TCID_4196; createClientProspect.py:1137; 2147483678
INFO:2017-02-06 12:18:08,206; TCID_4196; createClientProspect.py:1138; []
INFO:2017-02-06 12:18:08,236; TCID_4196; actionBase.py:103; [FAIL] Failed to create a new Client Prospect
INFO:2017-02-06 12:18:08,236; TCID_4196; actionBase.py:114; Taking a snapshot with filename = screen10319120170206121808.jpg
INFO:2017-02-06 12:18:08,276; TCID_4196; createClientProspect.py:949; Traceback (most recent call last):
File "C:\ProgramData\sift_client_selenium\developer\createClientProspect.py", line 931, in createNewClientProspect
result = self.launchNewProfileWindowFirstNameLastName(firstName,lastName) and self.enterProspectDetails() \
File "C:\ProgramData\sift_client_selenium\developer\createClientProspect.py", line 1139, in launchNewProfileWindowFirstNameLastName
self.browser.switch_to_frame("WorkAreaFrame1popup")
File "c:\python27\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 574, in switch_to_frame
self._switch_to.frame(frame_reference)
File "c:\python27\lib\site-packages\selenium\webdriver\remote\switch_to.py", line 85, in frame
raise NoSuchFrameException(frame_reference)
NoSuchFrameException: Message: WorkAreaFrame1popup
Solution 1:[1]
This should not be an issue.
If this Firefox version does not display an iframe then you don't have to switch, just add an if
condition and switch if iframe
is found, else do nothing.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | lauda |