Comments (4)
Thanks! I'll take a look.
from elemental-selenium-tips.
If you're receiving that error than the jQuery Growl library isn't loading correctly during your test's browser session.
Can you provide your test code?
from elemental-selenium-tips.
I've copied and pasted the code provided on your project the differences are I used TestNG instead of JUnit there & Chrome instead of Firefox.
Below is the code.
package com.ratedr.growl;
import java.io.File;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class Growl {
WebDriver driver;
JavascriptExecutor js;
@BeforeClass
public void setUp() throws Exception {
File file = new File(System.getProperty("user.dir") + "//chromedriver.exe");
System.setProperty("webdriver.chrome.driver", file.getAbsolutePath());
driver = new ChromeDriver();
js = (JavascriptExecutor) driver;
}
@AfterClass
public void tearDown() throws Exception {
driver.quit();
}
@Test
public void growlTest() throws InterruptedException {
driver.get("http://the-internet.herokuapp.com/");
// Check for jQuery on the page, add it if need be
js.executeScript("if (!window.jQuery) {"
+ "var jquery = document.createElement('script'); jquery.type = 'text/javascript';"
+ "jquery.src = 'https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js';"
+ "document.getElementsByTagName('head')[0].appendChild(jquery);" + "}");
// Use jQuery to add jquery-growl to the page
js.executeScript("$.getScript('http://the-internet.herokuapp.com/js/vendor/jquery.growl.js')");
// Use jQuery to add jquery-growl styles to the page
js.executeScript("$('head').append('<link rel=\"stylesheet\" "
+ "href=\"http://the-internet.herokuapp.com/css/jquery.growl.css\" " + "type=\"text/css\" />');");
// jquery-growl w/ no frills
js.executeScript("$.growl({ title: 'GET', message: '/' });");
// jquery-growl w/ colorized output
js.executeScript("$.growl.error({ title: 'ERROR', message: 'your error message goes here' });");
js.executeScript("$.growl.notice({ title: 'Notice', message: 'your notice message goes here' });");
js.executeScript("$.growl.warning({ title: 'Warning!', message: 'your warning message goes here' });");
Thread.sleep(5000);
}
}
from elemental-selenium-tips.
Hi @tourdedave ,
Anything you found in it?
from elemental-selenium-tips.
Related Issues (10)
- DownloadFileRevisited is just an assertion, right? HOT 1
- Marionette Driver instead of FirefoxDriver HOT 1
- Question - RE Ruby Updates HOT 2
- Application error HOT 2
- Automatic code quality checks for Python?
- Drag N Drop Java Example - no working example HOT 4
- Incorrect Content-Type in download file example (ruby)
- http://the-internet.herokuapp.com/context_menu is not working on Firefox 65.0.1
- How can we import the driver and By class in the javascript file ? i am not able to resolve the issue for a custom plugin created by me for selenium ide please help me out
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elemental-selenium-tips.