123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import sys
- import time
- sys.path.insert(0,'./web')
- import browser_common
- from selenium import webdriver
- from selenium.webdriver.common.keys import Keys
- from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
- jb=browser_common.JBrowser()
- jb.set_profile_path(None)
- driver=jb.get_driver()
- jb.get('https://google.com')
- time.sleep(2)
- driver.execute_script("window.location.href = 'https://www.similarweb.com';")
- elmt=driver.find_element_by_xpath("//input[@class='app-search__input']")
- webdriver.ActionChains(driver).move_to_element(elmt).perform()
- webdriver.ActionChains(driver).move_to_element(elmt).click().perform()
- webdriver.ActionChains(driver).move_to_element(elmt).click().perform()
- time.sleep(5)
- elmt.send_keys('similarweb.com')
- elmt=driver.find_element_by_xpath("//button[@class='swui-button swui-button--solid swui-button--primary swui-button--brand swui-button--sm']")
- webdriver.ActionChains(driver).move_to_element(elmt).perform()
- webdriver.ActionChains(driver).move_to_element(elmt).click().perform()
- time.sleep(10)
- elmt=driver.find_element_by_xpath("//a[@data-analytics-label='Country Rank/158']")
- print(elmt.text)
- elmt=driver.find_element_by_xpath("//a[@data-analytics-label='Category Rank/computers-electronics-and-technology/social-networks-and-online-communities']")
- print(elmt.text)
- elmts=driver.find_elements_by_xpath("//div[@class='websiteRanks-valueContainer js-websiteRanksValue']")
- for elmt in elmts:
- print(elmt.text)
|