BeautifulSoup does not extract commet tags in dynamic page











up vote
0
down vote

favorite












What I need: Count the number of reviews under an extension in Chrome Store in all languages.
What I did: Tried BeautifulSoup to extract a certain tag. I reserched the html-code of the page and found a review tag:
enter image description here



Tried this code:



    from bs4 import BeautifulSoup
import requests
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html5lib')
comments = soup.find_all('div', class_ = 'ba-bc-Xb ba-ua-zl-Xb')


But print(comments) shows that the array is empty.

I am stuck at the moment and I see that further I need to handle two problems:




  1. How to cope with select language buttom? How to count reviews in all languages if by default only one language is selected.
    selecting certain language


  2. The reviews are stored in different tabs. I read about dynamically extract it but didn't get a point.



different tabs










share|improve this question
























  • I guess you should add page number and required language to your URL as parameters, but it depends on how server set to send data
    – Andersson
    Nov 21 at 9:07












  • Can you provide the initial URL for testing?
    – QHarr
    Nov 21 at 9:35










  • chrome.google.com/webstore/detail/evernote-web-clipper/… for ex
    – Sergei Shumilin
    Nov 21 at 10:47















up vote
0
down vote

favorite












What I need: Count the number of reviews under an extension in Chrome Store in all languages.
What I did: Tried BeautifulSoup to extract a certain tag. I reserched the html-code of the page and found a review tag:
enter image description here



Tried this code:



    from bs4 import BeautifulSoup
import requests
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html5lib')
comments = soup.find_all('div', class_ = 'ba-bc-Xb ba-ua-zl-Xb')


But print(comments) shows that the array is empty.

I am stuck at the moment and I see that further I need to handle two problems:




  1. How to cope with select language buttom? How to count reviews in all languages if by default only one language is selected.
    selecting certain language


  2. The reviews are stored in different tabs. I read about dynamically extract it but didn't get a point.



different tabs










share|improve this question
























  • I guess you should add page number and required language to your URL as parameters, but it depends on how server set to send data
    – Andersson
    Nov 21 at 9:07












  • Can you provide the initial URL for testing?
    – QHarr
    Nov 21 at 9:35










  • chrome.google.com/webstore/detail/evernote-web-clipper/… for ex
    – Sergei Shumilin
    Nov 21 at 10:47













up vote
0
down vote

favorite









up vote
0
down vote

favorite











What I need: Count the number of reviews under an extension in Chrome Store in all languages.
What I did: Tried BeautifulSoup to extract a certain tag. I reserched the html-code of the page and found a review tag:
enter image description here



Tried this code:



    from bs4 import BeautifulSoup
import requests
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html5lib')
comments = soup.find_all('div', class_ = 'ba-bc-Xb ba-ua-zl-Xb')


But print(comments) shows that the array is empty.

I am stuck at the moment and I see that further I need to handle two problems:




  1. How to cope with select language buttom? How to count reviews in all languages if by default only one language is selected.
    selecting certain language


  2. The reviews are stored in different tabs. I read about dynamically extract it but didn't get a point.



different tabs










share|improve this question















What I need: Count the number of reviews under an extension in Chrome Store in all languages.
What I did: Tried BeautifulSoup to extract a certain tag. I reserched the html-code of the page and found a review tag:
enter image description here



Tried this code:



    from bs4 import BeautifulSoup
import requests
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html5lib')
comments = soup.find_all('div', class_ = 'ba-bc-Xb ba-ua-zl-Xb')


But print(comments) shows that the array is empty.

I am stuck at the moment and I see that further I need to handle two problems:




  1. How to cope with select language buttom? How to count reviews in all languages if by default only one language is selected.
    selecting certain language


  2. The reviews are stored in different tabs. I read about dynamically extract it but didn't get a point.



different tabs







python selenium-webdriver web-scraping beautifulsoup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 16:24









ewwink

6,72922233




6,72922233










asked Nov 21 at 8:31









Sergei Shumilin

348




348












  • I guess you should add page number and required language to your URL as parameters, but it depends on how server set to send data
    – Andersson
    Nov 21 at 9:07












  • Can you provide the initial URL for testing?
    – QHarr
    Nov 21 at 9:35










  • chrome.google.com/webstore/detail/evernote-web-clipper/… for ex
    – Sergei Shumilin
    Nov 21 at 10:47


















  • I guess you should add page number and required language to your URL as parameters, but it depends on how server set to send data
    – Andersson
    Nov 21 at 9:07












  • Can you provide the initial URL for testing?
    – QHarr
    Nov 21 at 9:35










  • chrome.google.com/webstore/detail/evernote-web-clipper/… for ex
    – Sergei Shumilin
    Nov 21 at 10:47
















I guess you should add page number and required language to your URL as parameters, but it depends on how server set to send data
– Andersson
Nov 21 at 9:07






I guess you should add page number and required language to your URL as parameters, but it depends on how server set to send data
– Andersson
Nov 21 at 9:07














Can you provide the initial URL for testing?
– QHarr
Nov 21 at 9:35




Can you provide the initial URL for testing?
– QHarr
Nov 21 at 9:35












chrome.google.com/webstore/detail/evernote-web-clipper/… for ex
– Sergei Shumilin
Nov 21 at 10:47




chrome.google.com/webstore/detail/evernote-web-clipper/… for ex
– Sergei Shumilin
Nov 21 at 10:47












2 Answers
2






active

oldest

votes

















up vote
0
down vote













You could use selenium to perform the tasks and waits for page changes and extract the review count from the PaginationMessage. Tested with a few links. You may need to add error handling for items with no reviews. There also seems to be some POST XHR activity yielding review JSON strings that you may wish to explore.



from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

url = 'https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en/'
#url = 'https://chrome.google.com/webstore/detail/https-everywhere/gcbommkclmclpchllfjekcdonpmejbdp?hl=en/'
d = webdriver.Chrome()
d.get(url)
WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.ID, ':21'))).click()
ActionChains(d).click_and_hold(WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca')))).perform()
languageSelection = WebDriverWait(d, 5).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, '.g-aa-ca-ma-x-L')))
languageSelection[1].click()

s= WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.Aa.dc-tf + span'))).text
print(s.split()[-1])
d.quit()





share|improve this answer























  • Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
    – Sergei Shumilin
    Nov 21 at 13:53










  • Two ticks and I will update.
    – QHarr
    Nov 21 at 13:54










  • try the updated script
    – QHarr
    Nov 21 at 14:07










  • 168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
    – Sergei Shumilin
    Nov 21 at 14:30










  • I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
    – QHarr
    Nov 21 at 14:37


















up vote
0
down vote













try this



from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()

driver.get('https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en')
wait = WebDriverWait(driver, 5)
wait.until(EC.visibility_of_element_located((By.ID, ':21'))).click()
wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca'))
).click()

english = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('English: ' + english.split()[-1])

wait.until(
EC.visibility_of_element_located((By.XPATH, '//div[@class="g-aa-ca-ma-x-L" and text() = "All languages"]'))
).click()
wait.until_not(EC.text_to_be_present_in_element((By.XPATH, '//div[@class="ah-mg-j"]/span'), english))
time.sleep(2)

AllCount = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('All languages: ' + AllCount.split()[-1])
driver.close()





share|improve this answer





















  • Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
    – Sergei Shumilin
    Nov 21 at 16:52













Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407963%2fbeautifulsoup-does-not-extract-commet-tags-in-dynamic-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













You could use selenium to perform the tasks and waits for page changes and extract the review count from the PaginationMessage. Tested with a few links. You may need to add error handling for items with no reviews. There also seems to be some POST XHR activity yielding review JSON strings that you may wish to explore.



from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

url = 'https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en/'
#url = 'https://chrome.google.com/webstore/detail/https-everywhere/gcbommkclmclpchllfjekcdonpmejbdp?hl=en/'
d = webdriver.Chrome()
d.get(url)
WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.ID, ':21'))).click()
ActionChains(d).click_and_hold(WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca')))).perform()
languageSelection = WebDriverWait(d, 5).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, '.g-aa-ca-ma-x-L')))
languageSelection[1].click()

s= WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.Aa.dc-tf + span'))).text
print(s.split()[-1])
d.quit()





share|improve this answer























  • Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
    – Sergei Shumilin
    Nov 21 at 13:53










  • Two ticks and I will update.
    – QHarr
    Nov 21 at 13:54










  • try the updated script
    – QHarr
    Nov 21 at 14:07










  • 168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
    – Sergei Shumilin
    Nov 21 at 14:30










  • I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
    – QHarr
    Nov 21 at 14:37















up vote
0
down vote













You could use selenium to perform the tasks and waits for page changes and extract the review count from the PaginationMessage. Tested with a few links. You may need to add error handling for items with no reviews. There also seems to be some POST XHR activity yielding review JSON strings that you may wish to explore.



from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

url = 'https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en/'
#url = 'https://chrome.google.com/webstore/detail/https-everywhere/gcbommkclmclpchllfjekcdonpmejbdp?hl=en/'
d = webdriver.Chrome()
d.get(url)
WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.ID, ':21'))).click()
ActionChains(d).click_and_hold(WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca')))).perform()
languageSelection = WebDriverWait(d, 5).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, '.g-aa-ca-ma-x-L')))
languageSelection[1].click()

s= WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.Aa.dc-tf + span'))).text
print(s.split()[-1])
d.quit()





share|improve this answer























  • Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
    – Sergei Shumilin
    Nov 21 at 13:53










  • Two ticks and I will update.
    – QHarr
    Nov 21 at 13:54










  • try the updated script
    – QHarr
    Nov 21 at 14:07










  • 168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
    – Sergei Shumilin
    Nov 21 at 14:30










  • I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
    – QHarr
    Nov 21 at 14:37













up vote
0
down vote










up vote
0
down vote









You could use selenium to perform the tasks and waits for page changes and extract the review count from the PaginationMessage. Tested with a few links. You may need to add error handling for items with no reviews. There also seems to be some POST XHR activity yielding review JSON strings that you may wish to explore.



from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

url = 'https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en/'
#url = 'https://chrome.google.com/webstore/detail/https-everywhere/gcbommkclmclpchllfjekcdonpmejbdp?hl=en/'
d = webdriver.Chrome()
d.get(url)
WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.ID, ':21'))).click()
ActionChains(d).click_and_hold(WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca')))).perform()
languageSelection = WebDriverWait(d, 5).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, '.g-aa-ca-ma-x-L')))
languageSelection[1].click()

s= WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.Aa.dc-tf + span'))).text
print(s.split()[-1])
d.quit()





share|improve this answer














You could use selenium to perform the tasks and waits for page changes and extract the review count from the PaginationMessage. Tested with a few links. You may need to add error handling for items with no reviews. There also seems to be some POST XHR activity yielding review JSON strings that you may wish to explore.



from selenium import webdriver
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains

url = 'https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en/'
#url = 'https://chrome.google.com/webstore/detail/https-everywhere/gcbommkclmclpchllfjekcdonpmejbdp?hl=en/'
d = webdriver.Chrome()
d.get(url)
WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.ID, ':21'))).click()
ActionChains(d).click_and_hold(WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca')))).perform()
languageSelection = WebDriverWait(d, 5).until(EC.visibility_of_all_elements_located((By.CSS_SELECTOR, '.g-aa-ca-ma-x-L')))
languageSelection[1].click()

s= WebDriverWait(d, 5).until(EC.visibility_of_element_located((By.CSS_SELECTOR, '.Aa.dc-tf + span'))).text
print(s.split()[-1])
d.quit()






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 21 at 14:07

























answered Nov 21 at 12:57









QHarr

26.7k81839




26.7k81839












  • Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
    – Sergei Shumilin
    Nov 21 at 13:53










  • Two ticks and I will update.
    – QHarr
    Nov 21 at 13:54










  • try the updated script
    – QHarr
    Nov 21 at 14:07










  • 168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
    – Sergei Shumilin
    Nov 21 at 14:30










  • I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
    – QHarr
    Nov 21 at 14:37


















  • Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
    – Sergei Shumilin
    Nov 21 at 13:53










  • Two ticks and I will update.
    – QHarr
    Nov 21 at 13:54










  • try the updated script
    – QHarr
    Nov 21 at 14:07










  • 168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
    – Sergei Shumilin
    Nov 21 at 14:30










  • I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
    – QHarr
    Nov 21 at 14:37
















Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
– Sergei Shumilin
Nov 21 at 13:53




Thanks for the answer. The result is 110 what is equals to the number of reviews on the first tab in russian, I need to count overall number of reviews in all languages.
– Sergei Shumilin
Nov 21 at 13:53












Two ticks and I will update.
– QHarr
Nov 21 at 13:54




Two ticks and I will update.
– QHarr
Nov 21 at 13:54












try the updated script
– QHarr
Nov 21 at 14:07




try the updated script
– QHarr
Nov 21 at 14:07












168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
– Sergei Shumilin
Nov 21 at 14:30




168. It's still not the overall number. But I'm grateful for your work. When it script is performed I see how Chrome browser works in real time (it opens and turn pages on its own) but if the number of tabs are very big - it means that I need to wait a lot of time the webdriver to extract it.
– Sergei Shumilin
Nov 21 at 14:30












I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
– QHarr
Nov 21 at 14:37




I'm confused. If I use your link and go to the reviews tab and select all languages I see 168 as the number of reviews. What is the expected number?
– QHarr
Nov 21 at 14:37












up vote
0
down vote













try this



from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()

driver.get('https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en')
wait = WebDriverWait(driver, 5)
wait.until(EC.visibility_of_element_located((By.ID, ':21'))).click()
wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca'))
).click()

english = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('English: ' + english.split()[-1])

wait.until(
EC.visibility_of_element_located((By.XPATH, '//div[@class="g-aa-ca-ma-x-L" and text() = "All languages"]'))
).click()
wait.until_not(EC.text_to_be_present_in_element((By.XPATH, '//div[@class="ah-mg-j"]/span'), english))
time.sleep(2)

AllCount = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('All languages: ' + AllCount.split()[-1])
driver.close()





share|improve this answer





















  • Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
    – Sergei Shumilin
    Nov 21 at 16:52

















up vote
0
down vote













try this



from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()

driver.get('https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en')
wait = WebDriverWait(driver, 5)
wait.until(EC.visibility_of_element_located((By.ID, ':21'))).click()
wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca'))
).click()

english = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('English: ' + english.split()[-1])

wait.until(
EC.visibility_of_element_located((By.XPATH, '//div[@class="g-aa-ca-ma-x-L" and text() = "All languages"]'))
).click()
wait.until_not(EC.text_to_be_present_in_element((By.XPATH, '//div[@class="ah-mg-j"]/span'), english))
time.sleep(2)

AllCount = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('All languages: ' + AllCount.split()[-1])
driver.close()





share|improve this answer





















  • Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
    – Sergei Shumilin
    Nov 21 at 16:52















up vote
0
down vote










up vote
0
down vote









try this



from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()

driver.get('https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en')
wait = WebDriverWait(driver, 5)
wait.until(EC.visibility_of_element_located((By.ID, ':21'))).click()
wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca'))
).click()

english = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('English: ' + english.split()[-1])

wait.until(
EC.visibility_of_element_located((By.XPATH, '//div[@class="g-aa-ca-ma-x-L" and text() = "All languages"]'))
).click()
wait.until_not(EC.text_to_be_present_in_element((By.XPATH, '//div[@class="ah-mg-j"]/span'), english))
time.sleep(2)

AllCount = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('All languages: ' + AllCount.split()[-1])
driver.close()





share|improve this answer












try this



from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

driver = webdriver.Chrome()

driver.get('https://chrome.google.com/webstore/detail/evernote-web-clipper/pioclpoplcdbaefihamjohnefbikjilc?hl=en')
wait = WebDriverWait(driver, 5)
wait.until(EC.visibility_of_element_located((By.ID, ':21'))).click()
wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, '.h-z-Ba-ca.ga-dd-Va.g-aa-ca'))
).click()

english = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('English: ' + english.split()[-1])

wait.until(
EC.visibility_of_element_located((By.XPATH, '//div[@class="g-aa-ca-ma-x-L" and text() = "All languages"]'))
).click()
wait.until_not(EC.text_to_be_present_in_element((By.XPATH, '//div[@class="ah-mg-j"]/span'), english))
time.sleep(2)

AllCount = driver.find_element_by_xpath('//div[@class="ah-mg-j"]/span').text
print('All languages: ' + AllCount.split()[-1])
driver.close()






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 21 at 16:21









ewwink

6,72922233




6,72922233












  • Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
    – Sergei Shumilin
    Nov 21 at 16:52




















  • Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
    – Sergei Shumilin
    Nov 21 at 16:52


















Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
– Sergei Shumilin
Nov 21 at 16:52






Thank you for help. It returns:English: 128 All languages: 168 It's not the total number on all tabs
– Sergei Shumilin
Nov 21 at 16:52




















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53407963%2fbeautifulsoup-does-not-extract-commet-tags-in-dynamic-page%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Berounka

Sphinx de Gizeh

Different font size/position of beamer's navigation symbols template's content depending on regular/plain...