0

So I am trying to automate inputting some "ads" in my webpage using Excel and VBA +selenium. So far I have managed to fill in all the info I need, but I can't click the button "publish item". Every line I have written for this action gives me an error 7 in execution time //insufficient memory.

The web is https://edenlife.es/osclassified/item/new

The code I have written is:

Sub Pruebas()

    ' Assuming you are using Selenium Basic for Excel (SeleniumWrapper)
    Dim obj As New WebDriver
    obj.Start "MicrosoftEdge", "Path\To\MicrosoftWebDriver.exe" 'Provide the correct path to MicrosoftWebDriver.exe
    
    obj.Get "https://edenlife.es/osclassified/item/new"

'DropDownMenu for Category
    ' Find the category dropdown element and click it
    obj.FindElementByCss(".simple-cat span.text").Click
    ' Find and click the desired category option by its text
    obj.FindElementByCss(".option.root[data-id='96']").Click ' Change the data-id accordingly

'Insert Title
 obj.FindElementById("titleen_US").SendKeys "TESTING"


' Introduce a small delay of 500 milliseconds
    Application.Wait (Now + TimeValue("0:00:01"))

'DropDownMenu for location = missing


' Switch to the iframe containing the TinyMCE editor
    obj.SwitchToFrame obj.FindElementByCss("#descriptionen_US_ifr")

    ' Input text into the TinyMCE editor
    obj.FindElementByCss("#tinymce").SendKeys "This is a test description."

    ' Switch back to the main content
    obj.SwitchToDefaultContent

' Introduce a small delay of 500 milliseconds
    Application.Wait (Now + TimeValue("0:00:01"))
    
    
    ' Continue with other actions
   
    obj.FindElementById("cityArea").SendKeys "Santander"
    obj.FindElementById("address").SendKeys "Calle San Luis 7"
    obj.FindElementById("contactName").SendKeys "Edenlife"
    obj.FindElementById("contactEmail").SendKeys "[email protected]"
    
' Introduce a small delay of 500 milliseconds
    Application.Wait (Now + TimeValue("0:00:01"))

   'DropDownMenu Edenred
     ' Select option from "Accepts EdenRed" dropdown
    obj.FindElementById("meta_accepts_edenred").AsSelect.SelectByText "Yes" ' Change "meta_accepts_edenred" to the actual ID of the dropdown
    obj.FindElementById("meta_vegan").AsSelect.SelectByText "Yes"
    obj.FindElementById("meta_playground").AsSelect.SelectByText "Yes"
    obj.FindElementById("meta_web").SendKeys "www.test.com"
    obj.FindElementById("meta_parking").AsSelect.SelectByText "Paid (Street)"
   
' Introduce a small delay of 500 milliseconds
    Application.Wait (Now + TimeValue("0:00:01"))
    
    ' Find and click the "Publish item" button // IVE TRIED ALL THESE:
    obj.FindElementByCss(".buttons-block .inside .box .row button.btn.alpBg").Click
   'obj.FindElementByCss(".btn.alpBg").Click
   
    'Other method:
    'obj.ExecuteScript "arguments[0].click();", obj.FindElementByCss(".buttons-block .inside .box .row button.btn.alpBg")
   'obj.FindElementByXPath("//button[contains(text(), ' Publish item')]").Click
   
End Sub

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.