0

Please find below code am trying to get Seller Proceeds value in Website, but it has $0, when i tried in console $0.value am getting 598.08 but am getting Calculate when i tried using this sel_proc = web.find_elements(id="afn-seller-proceeds")[0].text ''' Full Code :

import pandas as pd
from webbot import Browser
from bs4 import BeautifulSoup
web = Browser()
##web.set_window_position(-10000,0)
df = pd.read_excel('sample.xlsx')

soafees = []
fulfees = []
selproc = []
for ind in df.index:
    web.go_to('https://somelink')
##    web.set_window_position(-10000,0)
    web.click(id='link_continue')
    print("Login Successful")
    asin = df['ASIN'][ind]
    sp = int(df['Selling Price'][ind])
    print(sp)
    cp = int(df['Cost of Product'][ind])
    print(cp)
    web.type(df['ASIN'][ind] , into = 'Enter your product name, UPC, EAN, ISBN or ASIN',clear = True)
    web.click(id='a-autoid-0')
    web.type(sp,tag='input',id='afn-pricing',clear = True)
    web.type(cp,tag='input',id='afn-cost-of-goods',clear = True)
    web.click(id='update-fees-link')
    res = web.find_elements(id="afn-selling-fees")[0].text
    ful_fees = web.find_elements(id="afn-amazon-fulfillment-fees")[0].text
    sel_proc = web.find_elements(id="afn-seller-proceeds")[0].text
##    sel_proc = web.execute_script('return arguments[0].value;', element);
    print("soa fees : "+res)
    print("Fulfillment fees : "+ful_fees)
    print("Seller Proceeds : "+sel_proc)
    soafees.append(res)
    fulfees.append(ful_fees)
    selproc.append(sel_proc)
print(soafees)
print(fulfees)
print(selproc)
df_soa = pd.DataFrame(soafees,columns = ['SOA Fees'])
df_ful = pd.DataFrame(fulfees,columns = ['FBA Fees'])
df_sel = pd.DataFrame(selproc,columns = ['Seller Proceeds'])
print(df)
print(df_soa)
print(df_ful)
print(df_sel)

Snapshot for reference: enter image description here

thanks in advance for your support

Sharath
  • 61
  • 11

1 Answers1

0

In the sel_proc variable, you are storing the text, Instead, you should look for the attribute which has the value. I believe, in this case, it should be a "value" attribute.

sel_proc = web.find_elements(id="afn-seller-proceeds")[0].get_attribute(<attribute_name>)

Your code will look something like this:

sel_proc = web.find_elements(id="afn-seller-proceeds")[0].get_attribute("value")
sam
  • 2,263
  • 22
  • 34
  • getting blank when using `sel_proc = web.find_elements(id="afn-seller-proceeds")[0].get_attribute("value")` – Sharath May 05 '20 at 12:53
  • what other attributes you have? Get the sel_proc_element = web.find_elements(id="afn-seller-proceeds")[0] . It should have the required attribute. – sam May 05 '20 at 12:56
  • got below attributes: `Seller Proceeds : ` – Sharath May 05 '20 at 12:58
  • Can you try this? sel_proc = web.find_elements(id="afn-seller-proceeds")[0].get_attribute("$0.value") – sam May 05 '20 at 13:01
  • got None value - Seller Proceeds : None `sel_proc = web.find_elements(id="afn-seller-proceeds")[0].get_attribute("$0.value")` – Sharath May 05 '20 at 13:03
  • Ok, not sure then. The name of the attribute should be identified by debugging. – sam May 05 '20 at 13:07
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/213169/discussion-between-sharath-and-sam). – Sharath May 05 '20 at 13:10