Groovy Script that
- import openqa
- configure profile
- create webdriver
- manage DOM.window
- get url
- fetch soapui project parameter/property
- use data to enter data
- close driver
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.firefox.FirefoxDriver
import org.openqa.selenium.support.ui.ExpectedCondition
import org.openqa.selenium.support.ui.WebDriverWait
/*profile = webdriver.FirefoxProfile()
profile.set_preference('browser.window.width', 400)
profile.set_preference('browser.window.height',800)
profile.update_preferences()*/
// Create a new instance of the Firefox driver
// Notice that the remainder of the code relies on the interface,
// not the implementation.
WebDriver driver = new FirefoxDriver()
driver.manage().window().setPosition(new Point(100,100))
driver.manage().window().setSize(new Dimension(300,300))
//driver.window.setSize(500,500)
//driver.setSize(400,800)
// Open QRCode Generator
driver.get("http://www.the-qrcode-generator.com/")
WebElement element = driver.findElement(By.linkText("Generate"))
element.click()
def thisToken = testRunner.testCase.testSuite.getPropertyValue("TransactionToken")
element = driver.findElement(By.xpath("//textarea")).sendKeys("MCX.00000.${thisToken}")
//Close the browser
//driver.quit()
- Log in to post comments
