Jason 2 år sedan
förälder
incheckning
aea7733c4b
1 ändrade filer med 10 tillägg och 3 borttagningar
  1. 10 3
      website_clickjobs/type-1/_clickjob0113.py

+ 10 - 3
website_clickjobs/type-1/_clickjob0113.py

@@ -48,18 +48,18 @@ def process_query(domain, target_id, brands, query):
         driver.get('https://www.google.com/search?num=1000&q=艾立思&rlz=1C1ONGR_zh-TWTW997TW997&ei=zjdUY_DBG9Lm-Abpgq84&start=0&sa=N&filter=0&ved=2ahUKEwjw4KeEvfT6AhVSM94KHWnBCwcQ8tMDegQIARAQ&cshid=1666463754367857&biw=1368&bih=761&dpr=2')
         time.sleep(4)
     else:
-        driver.get('https://www.google.com/search?q='+query+'&num=100&filter=0')
+        driver.get('https://www.google.com?num=100')
         time.sleep(3)
         print(driver.current_url)
 
         # elmts=driver.find_elements_by_xpath("//div[@class='yuRUbf']/a")
         # ABOVE METHOD IS DEPRECATED STARTING SELENIUM 4.3.0, USE THIS
         #
-        '''elmt = driver.find_element(By.XPATH, "//input[@name='q']")
+        elmt = driver.find_element(By.XPATH, "//input[@name='q']")
         time.sleep(1)
 
         elmt.send_keys(query)
-        elmt.send_keys(Keys.ENTER)'''
+        elmt.send_keys(Keys.ENTER)
 
     idx=1
     ranking=-1
@@ -71,6 +71,13 @@ def process_query(domain, target_id, brands, query):
     if "sorry" in googleurl:
         return 444
 
+    try:
+        clickmore=driver.find_elements("xpath","//p[@class='ofr']/a")
+        webdriver.ActionChains(driver).move_to_element(el).perform()
+        webdriver.ActionChains(driver).move_to_element(el).click().perform()
+    except:
+        pass
+
     elmts=driver.find_elements("xpath","//div[@class='yuRUbf']/a")
 
     targets=[]