Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to login to wordpress with selenium wrapper because cookies are blocked?

I'm running an automated test on my wordpress website using selenium wrapper (through VBA).

When the login button is clicked, I get this error:

ERROR: Cookies are blocked or not supported by your browser

enter image description here

I've changed the settings in IE to accept all cookies. Chrome does accept cookies by default but for some reason, this doesn't seem to work. Could it be the user agent?

My wordpress version is 4.5

'Login code 
Sub InitiateLogin()

    web_driver.get "wp-login", -1, False
    web_driver.findElementById(Base64DecodeString("STUFFHERE")).SendKeys Base64DecodeString("STUFFHERE")
    web_driver.findElementById(Base64DecodeString("STUFFHERE")).SendKeys Base64DecodeString("STUFFHERE")
    web_driver.findElementById("wp-submit").Click
    web_driver.setTimeout ("120000")
    web_driver.setImplicitWait (5000)
   End Sub
like image 798
Amen Jlili Avatar asked Oct 31 '22 04:10

Amen Jlili


1 Answers

I was able to login to the account without issues using the below code.

Private driver As SeleniumWrapper.WebDriver

Private Sub Login()
    Set driver = New SeleniumWrapper.WebDriver
    Call driver.Start("chrome", "https://wordpress.com/")

    driver.get ("/wp-login.php")
    driver.findElementById("user_login").Clear
    driver.findElementById("user_login").SendKeys "your userid here"
    driver.findElementById("user_pass").Clear
    driver.findElementById("user_pass").SendKeys "your password here"
    driver.findElementById("wp-submit").Click
End Sub

Hope this helps.

like image 164
Manohar Swamynathan Avatar answered Nov 15 '22 06:11

Manohar Swamynathan