Reputation: 4811
I have 2 Xpaths from a DOM :
id("viewproduct-emagoo")/div[@class="big-box"]/div[@class="container-top mb10"]/div[@class="left-content"]/div[@class="container-detalii-produs"]/h2[1]
and
id("viewproduct-emagoo")/div[@class="big-box"]/div[@class="container-top mb10"]/div[@class="left-content"]/div[@class="container-detalii-produs"]/form[1]/div[1]/div[@class="info-box-produs"]/div[@class="disponibilitate-produs"]/div[@class="pret-produs"]/span[1]
I want to extract the Element/s value from one of the above xpaths using JAVASCRIPT.
If someone can find an old article about this, pls give me the link.
Upvotes: 0
Views: 187
Reputation: 167716
Assuming you have an XPath expression selecting an element node with Mozilla or Opera or Chrome or Safari then simply do
document.getElementById("form_selected_product_name").value
= lookupElementByXPath(value).textContent;
Upvotes: 1