I am at a sticking point with an Amazon bot I have been writing.. I have read many articles on the potential problem, and I have also tried testing various combinations of workarounds, which have unfortunately not fixed the problem.
The task that I am trying to accomplish is the sending of a post-purchase order customization message to an Amazon seller. The programming workflow is as follows:
- Click "problem with order"
- Click "other issue"
- Click "Contact seller"
- Click "Select Reason" dropdown menu
- Click "Product customization" dropdown option
- Click "Describe your issue" textarea <-- PROBLEM HERE
- Click "Send" button
Those familiar with this section of the Amazon website will know exactly what I am referring to.
The problem occurs with the textarea which does not validate upon clicking the send button, however upon inspecting a screenshot the text is visible within the textarea. I am going to supply the DOM of the textarea to see if that helps anyone provide insight into what may be happening here:
<div id="CONTACT_SELLER_OTHER_form" >
<div >
<div >
<p >
<span id="CONTACT_SELLER_OTHER_prompt">Contact the seller and allow the seller two days to get back to you</span>
</p>
<span data-action="text-changed" data-csa-c-type="widget" data-csa-c-func-deps="aui-da-text-changed" data-text-changed="{"inputPrefix":"CONTACT_SELLER_OTHER"}" data-csa-c-id="fetpfe-xkh75w-hthgz8-ywllw">
<div ><textarea maxlength="4000" placeholder="Describe your issue" id="CONTACT_SELLER_OTHER_changeBody" rows="4" name="changeText" spellcheck="true"></textarea></div>
</span>
<div >
<span id="CONTACT_SELLER_OTHER_remChars" >
4000
</span>
<span >
characters remaining
</span>
</div>
<div >
<span data-action="clickable-action-declarative" data-csa-c-type="widget" data-csa-c-func-deps="aui-da-clickable-action-declarative" data-clickable-action-declarative="{}" data-csa-c-id="8mu792-691pf8-tyadjf-wkj88p">
<span data-action="submit-problem" data-csa-c-type="widget" data-csa-c-func-deps="aui-da-submit-problem" data-submit-problem="{"reason":"OTHER","problem":"{\"id\":\"amzn1.pwo.v1.2021362jn4mw8uqqzgnaethmlm8ow\",\"version\":\"1\",\"amount\":33.95,\"baseCurrency\":\"USD\",\"orderId\":\"112-9877121-7313815\",\"countryCode\":\"US\",\"submittedTime\":\"2021-12-28T06:21:15.238Z\",\"comments\":\"Please cancel this order. Thanks!\",\"submitter\":{\"role\":\"Claimant\",\"login\":\"unknown\",\"customerId\":\"A152MSST3GCKQF\"},\"marketplaceId\":\"ATVPDKIKX0DER\",\"claimantId\":\"A152MSST3GCKQF\",\"respondentId\":\"A1DI45MUWFG9A6\",\"onscreenResolution\":false,\"claimRequesterId\":\"A23ZP02F085DFQ\",\"avenue\":{\"avenueCode\":\"CONTACT_SELLER\",\"displayName\":\"Contact seller\",\"displaySubText\":\"\",\"actionText\":\"Contact seller\",\"postSubmissionConfirmationText\":\"Message sent\",\"postSubmissionConfirmationSubText\":\"If the seller does not resolve your issue within 48 hours of the first message, you can revisit this page to check if you are eligible to request an A-to-z Guarantee refund.\"},\"reason\":{\"reasonCode\":\"OTHER\",\"detailCode\":\"CANCEL_ORDER\",\"displayString\":\"Other issue\",\"displayDetailText\":\"Request cancellation\"},\"csaState\":{},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{},\"investigationState\":{},\"changeOptions\":[{\"actor\":{\"role\":\"Claimant\",\"login\":\"unknown\",\"customerId\":\"A152MSST3GCKQF\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"PROVIDE_INFORMATION\",\"description\":\"Claimant changing state to 'ProblemState(csaState=Pending, claimantState=Pending, respondentState=Pending, investigationState=ActionRequired, legacyStatus=INVG)' via HealBeam; reason=PROVIDE_INFORMATION\",\"csaState\":{\"status\":\"Pending\"},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{\"status\":\"Pending\"},\"investigationState\":{\"status\":\"ActionRequired\"},\"commentsRequired\":true,\"legacyStatus\":\"INVG\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"Claimant\",\"login\":\"unknown\",\"customerId\":\"A152MSST3GCKQF\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"CANCEL_PROBLEM\",\"description\":\"Claimant changing state to 'ProblemState(csaState=Resolved, claimantState=Resolved, respondentState=Resolved, investigationState=ActionRequired, legacyStatus=BWDQ)' via HealBeam; reason=CANCEL_PROBLEM\",\"csaState\":{\"status\":\"Resolved\"},\"claimantState\":{\"status\":\"Resolved\"},\"respondentState\":{\"status\":\"Resolved\"},\"investigationState\":{\"status\":\"ActionRequired\"},\"commentsRequired\":true,\"legacyStatus\":\"BWDQ\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"Respondent\",\"login\":\"unknown\",\"customerId\":\"A1DI45MUWFG9A6\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"PROVIDE_INFORMATION\",\"description\":\"Respondent changing state to 'ProblemState(csaState=Pending, claimantState=Pending, respondentState=Pending, investigationState=ActionRequired, legacyStatus=INVG)' via HealBeam; reason=PROVIDE_INFORMATION\",\"csaState\":{\"status\":\"Pending\"},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{\"status\":\"Pending\"},\"investigationState\":{\"status\":\"ActionRequired\"},\"commentsRequired\":true,\"legacyStatus\":\"INVG\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"GRANT\",\"csaState\":{\"status\":\"Resolved\"},\"claimantState\":{\"status\":\"Resolved\"},\"respondentState\":{\"status\":\"Resolved\"},\"investigationState\":{\"status\":\"Resolved\"},\"commentsRequired\":false,\"legacyStatus\":\"GRNT\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"CANCEL_PROBLEM\",\"csaState\":{\"status\":\"Resolved\"},\"claimantState\":{\"status\":\"Resolved\"},\"respondentState\":{\"status\":\"Resolved\"},\"investigationState\":{\"status\":\"Resolved\"},\"commentsRequired\":true,\"legacyStatus\":\"BWDR\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"NO_GRANT\",\"csaState\":{\"status\":\"Resolved\"},\"claimantState\":{\"status\":\"Resolved\"},\"respondentState\":{\"status\":\"Resolved\"},\"investigationState\":{\"status\":\"Resolved\"},\"commentsRequired\":false,\"legacyStatus\":\"NOGR\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"REQUEST_INFO_CLAIMANT\",\"csaState\":{\"status\":\"ActionRequired\"},\"claimantState\":{\"status\":\"ActionRequired\"},\"respondentState\":{\"status\":\"Pending\"},\"investigationState\":{\"status\":\"Pending\"},\"commentsRequired\":false,\"legacyStatus\":\"RABI\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"REQUEST_INFO_RESPONDENT\",\"csaState\":{\"status\":\"Pending\"},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{\"status\":\"ActionRequired\"},\"investigationState\":{\"status\":\"Pending\"},\"commentsRequired\":false,\"legacyStatus\":\"RASI\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"RESPONDENT_ISSUED_REFUND\",\"csaState\":{\"status\":\"Resolved\"},\"claimantState\":{\"status\":\"Resolved\"},\"respondentState\":{\"status\":\"Resolved\"},\"investigationState\":{\"status\":\"Resolved\"},\"commentsRequired\":false,\"legacyStatus\":\"SRFD\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"ClaimsOps\",\"login\":\"unknown\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"SNOOZE\",\"csaState\":{\"status\":\"Pending\"},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{\"status\":\"Pending\"},\"investigationState\":{\"status\":\"Pending\"},\"commentsRequired\":false,\"legacyStatus\":\"HOLD\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"CSA\",\"login\":\"unknown\",\"customerId\":\"A152MSST3GCKQF\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"PROVIDE_INFORMATION\",\"description\":\"CSA changing state to 'ProblemState(csaState=Pending, claimantState=Pending, respondentState=Pending, investigationState=ActionRequired, legacyStatus=INVG)' via HealBeam; reason=PROVIDE_INFORMATION\",\"csaState\":{\"status\":\"Pending\"},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{\"status\":\"Pending\"},\"investigationState\":{\"status\":\"ActionRequired\"},\"commentsRequired\":true,\"legacyStatus\":\"INVG\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"CSA\",\"login\":\"unknown\",\"customerId\":\"A152MSST3GCKQF\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"CANCEL_PROBLEM\",\"description\":\"CSA changing state to 'ProblemState(csaState=Resolved, claimantState=Resolved, respondentState=Resolved, investigationState=ActionRequired, legacyStatus=BWDQ)' via HealBeam; reason=CANCEL_PROBLEM\",\"csaState\":{\"status\":\"Resolved\"},\"claimantState\":{\"status\":\"Resolved\"},\"respondentState\":{\"status\":\"Resolved\"},\"investigationState\":{\"status\":\"ActionRequired\"},\"commentsRequired\":true,\"legacyStatus\":\"BWDQ\",\"claimOpsOverride\":false},{\"actor\":{\"role\":\"SeSu\",\"login\":\"unknown\",\"customerId\":\"A1DI45MUWFG9A6\"},\"changeDate\":\"2021-12-28T06:21:15.238Z\",\"reason\":\"PROVIDE_INFORMATION\",\"description\":\"SeSu changing state to 'ProblemState(csaState=Pending, claimantState=Pending, respondentState=Pending, investigationState=ActionRequired, legacyStatus=INVG)' via HealBeam; reason=PROVIDE_INFORMATION\",\"csaState\":{\"status\":\"Pending\"},\"claimantState\":{\"status\":\"Pending\"},\"respondentState\":{\"status\":\"Pending\"},\"investigationState\":{\"status\":\"ActionRequired\"},\"commentsRequired\":true,\"legacyStatus\":\"INVG\",\"claimOpsOverride\":false}]}","avenue":"CONTACT_SELLER"}" data-csa-c-id="o4f6cx-sxrdb0-fnajui-dbrzyw">
<span id="CONTACT_SELLER_button" ><span ><input type="submit" aria-labelledby="CONTACT_SELLER_button-announce"><span id="CONTACT_SELLER_button-announce" aria-hidden="true">
Send
</span></span></span>
</span>
</span>
</div>
</div>
</div>
</div>
I have experience with selenium and have read many possible solutions online which have unfortunately not been of any help. So, anyone who can provide help into what I am missing, I would be greatly appreciative of.
CodePudding user response:
I was able to determine the cause of the problem I had encountered. I am adding an answer for anyone who finds this post of StackOverflow and encounters a similar issue.
For whatever reason, the XPATH I had used to find the element had multiple occurrences within the DOM (was not outright obvious to me at the time). Consequently, when I performed a find_element_by_xpath, I was clicking on the first element in the array. To get the code to work as expected, I had to perform a find_elements_by_xpath and click on the last WebElement in the array.