Forum Discussion
- ccdssv1ContributorHI,
This can be easy done by using selenium and groovy script:
Step 1. Download selenium server and place it in <SoapUi Folder>/bin/ext: http://selenium-release.storage.googlea ... 2.43.1.jar
Step 2. If you are using an older soapUI version like me (4.6.4) you need to upgrade the http client libs http://mirror.tcpdiag.net/apache//httpc ... .5-bin.zip , unpack this in to <SoapUI Folder>/Lib
NOTE: since you have new version of this libs you need to delete the old one that ar found in your lib folder, just look at the version number from file name and delete the old version (small nr)
Step 3. Start SoapUI if you did the steps correct you should see in the soapUI Log tab : Wed Oct 22 20:18:12 EEST 2014:INFO:Adding [......\SoapUI-4.6.4-m-SNAPSHOT\bin\ext\selenium-server-standalone-2.43.1.jar] to extensions classpath
Step 4. Create an groovy script that will use selenium to login you on facebook website:
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import org.openqa.selenium.firefox.FirefoxDriver
userData = "facebook user "
passData = "facebook password"
WebDriver driver = new FirefoxDriver()
driver.navigate().to("https://www.facebook.com/")
//Input the user credentials and authorize the application;
if (driver.findElements(By.id("email")).size() == 1 ){
driver.findElement(By.id("email")).sendKeys(userData)
driver.findElement(By.id("pass")).sendKeys(passData)
driver.findElement(By.id("loginbutton")).click()
//you should be logged on the facebook page and do stuf here :)
} else log.info "Fail to load the facebook page"
driver.quit() - arttykhNew ContributorHi ccdssv1,
thank for your reply.
I have managed to do it using get/post requests.
First I've send GET facebook login page:
GET https://www.facebook.com/login.php?skip_api_login=1&api_key=my_key&signed_next=1&next=https%3A%2F%2Fwww.facebook.com%2Fv1.0%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fmy_site%252Fuser%252Fsignin%26scope%3Demail%252Cuser_about_me%252Cuser_birthday%26auth_type%3Drerequest%26client_id%3DmyID%26ret%3Dlogin&cancel_uri=https%3A%2F%2Fmy_site%2Fuser%2Fsignin%3Ferror%3Daccess_denied%26error_code%3D200%26error_description%3DPermissions%2Berror%26error_reason%3Duser_denied%23_%3D_&display=page
Then I've parsed facebook login form with Property Transfer step to get required values for inputs.
e.g: //*:input[@name="lsd"]/@value
In the last step I've send POST request with all required params:
POST https://www.facebook.com/login.php?login_attempt=1&next=https%3A%2F%2Fwww.facebook.com%2Fv1.0%2Fdialog%2Foauth%3Fredirect_uri%3Dhttps%253A%252F%252Fmy_site%252Fuser%252Fsignin%26scope%3Demail%252Cuser_about_me%252Cuser_birthday%26auth_type%3Drerequest%26client_id%my_id%26ret%3Dlogin
Body:
lsd=${#TestSuite#lsdValue}&api_key=${#TestSuite#apiKey}&display=page&enable_profile_selector=&legacy_return=1&profile_selector_ids=&skip_api_login=1&signed_next=1&trynum=1&timezone=${#TestSuite#timezoneValue}&lgnrnd=${#TestSuite#lgnrndValue}&lgnjs=${#TestSuite#lgnjsValue}&email=${#TestSuite#emailValue}&pass=${#TestSuite#passValue}&persistent=${#TestSuite#persistentValue}&default_persistent=${#TestSuite#defaultPersistentValue}&login=Log+in
After this I was signed in on my test web site. - fgvieiraContributor
Hello mate,
Could you give me help on that last thing you did? I'm not being able to reach the logic on how to parse the login form.
Thanks!
- JHuntCommunity Hero
In this case they were using Facebook, and they had to get a form value from the Facebook login page to include on the login request submission. That's not going to be needed for most other sites (there are lots of different ways that websites handle logging in).
Based on your other topic, I don't think you're using Facebook, so let's stick to that other topic and try to work out together what you need to do for your particular site or service.
Related Content
- 2 months ago
- 12 years ago
- 14 years ago
- 5 years ago
- 3 years ago
Recent Discussions
- 5 days ago