Open MarkoMackic opened 4 years ago
// Generated by Selenium IDE
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
import java.net.MalformedURLException;
import java.net.URL;
public class ExporthelloWorldTest {
private WebDriver driver;
private Map<String, Object> vars;
JavascriptExecutor js;
@Before
public void setUp() {
driver = new ChromeDriver();
js = (JavascriptExecutor) driver;
vars = new HashMap<String, Object>();
}
@After
public void tearDown() {
driver.quit();
}
public void das() {
driver.get("https://www.google.com/");
driver.manage().window().setSize(new Dimension(794, 510));
driver.findElement(By.name("q")).sendKeys("dsada");
driver.findElement(By.name("q")).sendKeys(Keys.ENTER);
[object Object]
}
@Test
public void exporthelloWorld() {
das();
}
}
An if
command also causes the [object Object]
problem, and the problem happens when exporting to any format. The main thing is that the complex command is in one test and the export is done on a test that run
s that other test. Here's a simple reproduction:
TestExportBug.zip
Here's the Python code it generates:
class TestMAIN():
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def subTestCase(self):
[object Object]
self.driver.find_element(By.LINK_TEXT, "scripts").click()
def test_mAIN(self):
self.driver.get("https://github.com/SeleniumHQ/selenium-ide")
self.subTestCase()
self.driver.close()
I am also seeing an issue if multiple other test cases are used with run
within a single test. When the test is exported, it only creates the first inner test case called.
Here is the Python code it generates:
class TestMAIN():
def setup_method(self, method):
self.driver = webdriver.Chrome()
self.vars = {}
def teardown_method(self, method):
self.driver.quit()
def subTestCase(self):
[object Object]
self.driver.find_element(By.LINK_TEXT, "scripts").click()
def test_mAIN(self):
self.driver.get("https://github.com/SeleniumHQ/selenium-ide")
self.subTestCase()
self.subTestCase2()
self.driver.close()
🐛 Bug Report
Exported method's can't resolve commands that are returned from emit methods as Objects. I used
wait for element not visible
. They end up as[object Object]
string in exported code. They are properly resolved in test methods.To Reproduce
Export the attached .side in any language.
Expected behavior
Complex commands are resolved.
Project file reproducing this issue (highly encouraged)
aaa.zip
Environment
OS : Win 10 Browser: Chrome 79 Selenium IDE: v3.16.1