Commit 9b1d700d authored by 李康's avatar 李康

adjust scroll parameters

parent 2788ec35
......@@ -4,6 +4,7 @@ import numpy as np
import sys, os, time
delim = "; "
filter_scroll_steps = 2
def clickBrand(d, brand_name):
print("Try finding brand %s......" % brand_name)
......@@ -65,16 +66,17 @@ def getAllFilterTypes(d):
new_flag = True
ftype_names.append(ftype.get_text())
if new_flag:
filter_pane.scroll.vert(steps=10)
filter_pane.scroll.vert(steps=filter_scroll_steps)
else:
break
filter_pane.scroll.vert.backward()
return ftype_names
def filterProduct(d, ftype_name):
print("Select the filter type %s" % ftype_name)
ftype = d(resourceId="org.c2h4.afei.beauty:id/tv_type", text=ftype_name)
while ftype.count == 0:
d(scrollable=True).scroll(steps=10)
d(scrollable=True).scroll(steps=filter_scroll_steps)
ftype = d(resourceId="org.c2h4.afei.beauty:id/tv_type", text=ftype_name)
ftype.click()
......@@ -304,11 +306,12 @@ def getProductByType(argv):
scraped_cnt = 0
with open(brand_name+"/products.csv", 'a+') as f:
ftype_names = getAllFilterTypes(d)
print("All the brand sub-types:")
for ftype_name in ftype_names:
print(ftype_name)
for ftype_name in ftype_names:
# if ftype_name != "护肤水":
# if ftype_name != "粉底·BB霜":
# continue
filterProduct(d, ftype_name)
time.sleep(1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment