I've been struggling with this selenium project and keep finding old references or posts that marginally relate to this issue. I admit I am new to xpath and selenium so hopefully it may be as simple as fixing my syntax. I'm using python 3.6.9 on lubuntu 19.10 if that makes any difference.
html element I'm trying to access:
<div class="NfvXc">
<textarea aria-label="Write a caption…" autocomplete="off" autocorrect="off"
class="_472V_" placeholder="Write a caption…"></textarea>
</div>
Code I've tried:
add_text = browser_object.find_element_by_xpath("//textarea[contains(@aria-label,'Write a caption...')]")
add_text = browser_object.find_element_by_xpath("//div[contains(text(),'Write a caption...')]")
Error messages I am ending up with when trying different xpaths:
error in process_image(): Message: Given xpath expression "//*div[contains(text(),'Write a caption...')]" is invalid: SyntaxError: The expression is not a legal expression.
I checked firefox to try and trap the xpath, shows up as:
/html/body/div[1]/section/div[2]/section[1]/div[1]/textarea
Although I'm not sure how to adjust my xpath to find that element as of yet, obviously.