问题
My application is using Mathml editor and i want to record button from this editor. i am using Selenium IDE, But not able to record any action from this editor.
i am new for selenium please help me out.
This is what I've tried so far:
driver.switchTo().frame("editML");
WebElement editor = driver.findElement(By.className("#editML"));
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].innerHTML = '<h1>Heading</h1>Hello World'", editor);
回答1:
You are trying to do too much in your code. Try this:
driver.switchTo().frame("editML");
WebElement editor = driver.findElement(By.xpath("//body"));
JavascriptExecutor jsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].innerHTML = 'Hello World'", editor);
回答2:
Although I haven’t tried it but it seems that in HTML 5 to have direct support for MathML elements the script could be: driver.switchTo().frame("editML");
WebElement editor = driver.findElement(By.className("#editML"));
JavascriptExecutorjsExecutor = (JavascriptExecutor) driver;
jsExecutor.executeScript("arguments[0].innerHTML = '<mi><h1>Heading</h1>Hello World</mi>'", editor);
For more info on tags follow the below link: http://www.tutorialspoint.com/html5/html5_mathml.htm
来源:https://stackoverflow.com/questions/25117060/software-testing-selenium-ide-web-driver