Reputation: 1
I am trying to find the value of an element on the page without loading the page, but after opening the desired page, I am quickly redirected to the login page.
[Tags] SaveOrder
Create Session saveOrder ${urlAPI}${saveOrder} cookies= ${session_cookie} verify=True
${body}= Create Dictionary sub_product_id=${productID} value=1 #value must fetch by xpath
${header}= Create Dictionary Accept=application/json
${response}= POST On Session saveOrder ${url_api}${saveOrder} json=${body} headers=${header}
${bodyResp} = Convert To Dictionary ${response.json()}
${dataResp}= Get From Dictionary ${bodyResp} data
${invURL}= Get From Dictionary ${dataResp} redirect_to
${invID}= Split String From Right ${invURL} https://main-api.iranicard.plzdev.ir/api/v1/factors/ 1
${ID}= Set Variable ${invURL}[1] #Get Invoice ID
Set Global Variable ${invoiceID} ${invID}[1]
${status} = Convert To String ${response.status_code}
Should Be Equal ${status} 200
Browser.New page https://main-panel.iranicard.plzdev.ir/invoice?id=${invoiceID}
sleep 120s
# Wait for the invoice page to load
Wait Until Element Is Visible ${walletBalance1} timeout=120s
Upvotes: 0
Views: 10