0

Good day. Im trying to learn how to use the Selenium IDE on firefox together with Python by exporting whatever test i did to Python 2.7.

During my test i ran into a few problems, one of them is that it isn't recognizing 2 text fields, which are inside iframes. Ive found some other answers right here on stack overflow but Im not really sure on how to apply them on my code. This is what i got from exporting directly from the Selenium IDE on firefox. I`m also completely new to python and programming in general, so any suggestion would also be welcome.

This is what i have right now:

# -*- coding: utf-8 -*-
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import NoAlertPresentException
import unittest, time, re

class StiMPythonWebdriver(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Firefox()
        self.driver.implicitly_wait(30)
        self.base_url = "https://webpage.com/"
        self.verificationErrors = []
        self.accept_next_alert = True

    def test_sti_m_python_webdriver(self):
        driver = self.driver
        driver.find_element_by_id("SEARCHS").clear()
        driver.find_element_by_id("SEARCHS").send_keys("403627") **It inserts a code of a form**
        driver.find_element_by_id("splitbutton1-button").click()
        # ERROR: Caught exception [ERROR: Unsupported command [waitForPopUp | details403627 | 100000]]
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details403627 | ]] **It waits a little for the pop up window to open so it can continue the test**
        driver.find_element_by_id("editButton_textSpan").click()
        Select(driver.find_element_by_id("status")).select_by_visible_text("Option 1")
        # ERROR: Caught exception [ERROR: Unsupported command [selectFrame | id=descrpt_ifr | ]]
        # ERROR: Caught exception [ERROR: Unsupported command [selectFrame | id=tinymce | ]] **Right here at this part it is supposed to select the <p> inside the Iframe and type the following sentence "Canceled"**


        driver.find_element_by_id("descrpt_ifr").clear()
        driver.find_element_by_id("descrpt_ifr").send_keys("Canceled")
        # ERROR: Caught exception [ERROR: Unsupported command [selectWindow | name=details403627 | ]]
        driver.find_element_by_id("goButton_textSpan").click()**then it selects a button that exits the pop up**
1
  • Your question is not clear to me. What do you want achieve actually?? Could you share relevant HTML as well and elaborate more ?? Commented Sep 21, 2016 at 19:57

1 Answer 1

1

If you want to switch to iframe

driver.switch_to_frame(driver.find_element_by_xpath("//iframe[@id='tinymce ']"))

If you want to switch to window -1 seems default active window

driver.switch_to_window(driver.window_handles[-1])

Don't forgot to switch back when you complete .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.