saucelabs-training / elemental-selenium-tips Goto Github PK
View Code? Open in Web Editor NEWOpen-sourced code examples Elemental Selenium tips
Home Page: http://elementalselenium.com/tips
License: MIT License
Open-sourced code examples Elemental Selenium tips
Home Page: http://elementalselenium.com/tips
License: MIT License
Environment -
OS: Windows 8
Selenium Version: 3.4.0
Browser: Google Chrome
Browser Version: Chrome 61.0 (64-bit)
Expected Behavior -
The script should work properly and the user can see the growl notification in the browser.
Actual Behavior -
Error display for the jQuery functions while running the script with Selenium & Java.
Stack trace -
org.openqa.selenium.WebDriverException: unknown error: $.growl is not a function
(Session info: chrome=61.0.3163.100)
(Driver info: chromedriver=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 6.2.9200 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds
Build info: version: '3.6.0', revision: '6fbf3ec767', time: '2017-09-27T15:28:36.4Z'
System info: host: 'RAHUL_P', ip: '192.168.1.180', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{mobileEmulationEnabled=false, hasTouchScreen=false, platform=XP, acceptSslCerts=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, platformName=XP, setWindowRect=true, unexpectedAlertBehaviour=, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.33.506120 (e3e53437346286c0bc2d2dc9aa4915ba81d9023f), userDataDir=C:\Users\Rahul_R\AppData\Local\Temp\scoped_dir2944_13820}, takesHeapSnapshot=true, pageLoadStrategy=normal, unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true, version=61.0.3163.100, browserConnectionEnabled=false, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}]
Session ID: 87062ace22da0ff40257f659089c4b1a
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:82)
at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:586)
at org.openqa.selenium.remote.RemoteWebDriver.executeScript(RemoteWebDriver.java:522)
at com.ratedr.growl.Growl.growlTest(Growl.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
I can't get Drag And Drop Java working. I've searched for hours and only find errors without solutions for MoveToElement and DragAndDrop and/or clickAndHold-MoveToElement-Release.
The following are some snippets of what I've tried:
`
public static final By COLUMN_A = By.id("column-a");
public static final By COLUMN_B = By.id("column-b");
@Test
public void dragAtoBTest() {
Actions action = new Actions(driver);
log.info("drag column-a to column-b position");
WebElement weA = driver.findElement(DragNDropPage.COLUMN_A);
WebElement weB = driver.findElement(DragNDropPage.COLUMN_B);
action.dragAndDrop(weA, weB).build().perform();
log.info("wait for opacity to change back to 1 from 0.4");
wait.until(ExpectedConditions.attributeToBe(weA, "opacity", "1"));
assertThat(weA.findElement(page.columnHeader).getText(), containsString("B"));
}
@Test
public void clickHoldMoveReleaseAtoBTest() {
Actions action = new Actions(driver);
log.info("click and hold column-a");
WebElement weA = driver.findElement(DragNDropPage.COLUMN_A);
WebElement weB = driver.findElement(DragNDropPage.COLUMN_B);
action.clickAndHold(weA)
.moveByOffset(-1, -1) // To fix issue with drag and drop in Chrome V61.0.3163.79
.moveToElement(weB,
weB.getLocation().getX()+weB.getSize().getWidth()/2,
weB.getLocation().getY()+weB.getSize().getHeight()/2)
.release(weB)
.build()
.perform();
// action.clickAndHold(weA).build().perform();
// log.info("moveToElement column-b");
// action.moveToElement(weB).build().perform();
// log.info("release on column-b");
// action.release().build().perform();
log.info("wait for opacity to change back to 1 from 0.4");
wait.until(ExpectedConditions.attributeToBe(weA, "opacity", "1"));
assertThat(weA.findElement(page.columnHeader).getText(), containsString("B"));`
Should we add checks on code quality that are automatically run each time changes are applied?
For Python, this would merely be running the tools Flake8 and Pylint in a Travis-CI configuration file, e.g.
# FILE: .travis.yml
language: python
python:
- 3.6
before_script:
- pip install flake8 pylint
script:
- flake8 */python
- pylint */python/*.py
This could (later) be extended to other languages. I would then suggest to use Travis' build stages feature to beautifully organize - visually separate, really - the linter results for the separate languages.
Please set correct Content-Type for downloading image file.
Thank you.
Affected file ../02-download-a-file/ruby/download.rb (line 17)
Actual:
profile['browser.helperApps.neverAsk.saveToDisk'] = 'images/jpeg, application/pdf'
Expected:
profile['browser.helperApps.neverAsk.saveToDisk'] = 'image/jpeg, application/pdf'
Cannot access your website:http://elementalselenium.com/tips.
Application error
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.
Hello @tourdedave is it possible to know more about marionette driver since FirefoxDriver is not working on latest Firefox version 47 and it is also said that marionette will be a standard in future?
Are you interested (More for my own improvement / getting involved more with Selenium Community), me updating some of the ruby items on here for newer rubies and using later RSpec notation on some of your earlier examples (1-20) ish.
I'm happy to do the work myself, it would be a good slow introduction into these.
Can i get some help for this ?
DownloadFileRevisited for Java is just an assertion, right? Because it isn't downloading anything at all, at least not in my case.
I suppose I need to instantiate the actual download function complimentarily, but I'm a newbie into Java and Selenium so I just want to be sure I'm not missing something here.
BTW, thanks for the great job and tutorials on Selenium WebDriver,
Dave.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.