Software Testing Selenium IDE/Web driver

孤街浪徒 提交于 2019-12-13 08:08:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!