' ' for query_characters in itertools.combinations_with_replacement(candidate_characters, length): query = ''.join(query_characters) editor = browser.find_element(By.CLASS_NAME, 'ql-editor') editor.send_keys(query) l = browser.find_element_by_id('chat_input_tab_ui') candidates = l.find_elements_by_tag_name('li') result = [candidate.text for candidate in candidates] f.write(json.dumps(dict(key=query, result=result))+'\n') 3文字までの英数字の組み合わせの全通り seleniumで直接入力し、サジェスト結果をそのまま保存 {'aaa': ['kaaba'], 'aab': ['kaaba', 'tanabata_tree'], 'aac': ['abacus', 'parachute'], 'aad': ['green_salad'], 'aae': [], 'aaf': ['falafel'], 'aag': [],