2

I am trying to get some data from https://www.facebook.com/public/nitin-solanki page. I can get all values apart from these label (values for these label I am already getting)

Someone suggested me to use Javascript executer with python to get these label, which I added, but they do not print any value neither give error.

Studied at Lives in From

driver.get("https://www.facebook.com/public/nitin-solanki")         
wait = WebDriverWait(driver, 10)
wait.until(EC.visibility_of_element_located((By.CLASS_NAME, "mbm")))
    for s in driver.find_elements_by_css_selector('.mbm.detailedsearch_result'):
        result = {}
        v =  s.find_element_by_css_selector('.fsm.fwn.fcg')
        x = v.find_elements_by_class_name('fbProfileBylineLabel')
        for y in x:
           #print y.text #this should give me label like lives in, studied at but does not
            #js line which does not give any result
            print x.executeScript("return arguments[0].childNodes[0].nodeValue;");
            print driver.executeScript("return arguments[0].childNodes[0].nodeValue;",x);
            #js ends
            z = y.find_elements_by_tag_name('a')
            for a in z:
                print a.text #I want to get label for this value along with it
3
  • print y.text works for me; executeScript is not a Python Selenium method, execute_script is Commented Jul 28, 2015 at 7:29
  • @dm295: thanks for comment, can you please help me to but anchor tag value associated with y.text in dictionary? Commented Jul 28, 2015 at 7:32
  • 1
    may you stop using a, v, z as the name of variable Commented Jul 28, 2015 at 8:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.