Last active
April 29, 2016 13:53
-
-
Save xymor/2ef5a12efad6e17fd651e350ba02f4ec to your computer and use it in GitHub Desktop.
Simple gebish/selenium automation, logs in by inserting user and pass, and do some things.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grapes([ | |
@Grab("org.gebish:geb-core:0.12.0"), | |
//@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.50.1"), | |
//@Grab("org.seleniumhq.selenium:selenium-support:2.50.1") | |
@Grab("org.seleniumhq.selenium:selenium-chrome-driver:2.21.0") | |
]) | |
import geb.Browser | |
Browser.drive { | |
quitCachedDriverOnShutdown = false; | |
go "https://url/login" | |
$('#loginForm').with { | |
j_username = "XXXX" | |
j_password = "XXXXXXXXX" | |
} | |
$('input[type=submit]').click() | |
(55..91).each{ | |
go "https://url/product/create" | |
$("form[action='/product/save']")."name" = "twg${it}" | |
$("form[action='/product/save']")."productPrice.defaultPrice" = "1" | |
$("form[action='/product/save']")."productPrice.salePrice" = "1" | |
$("form[action='/product/save']")."sku.inventory" = "999999" | |
$('.categoryFinderEnable').click() | |
waitFor(5){ | |
$("a[name='Importação Backoffice'] span").click() | |
$(".confirmCategory").click() | |
$("input[value='Salvar']").click() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment