i know this has been asked before but the last time it has been answered was about a year and a half ago main point is i want to

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver =     webdriver.Chrome(executable_path=r'C:\Users\Michelle\Downloads\chromedriver.exe')
username = 'username'
Itemvar1 = driver.execute_script("return prompt('Item name')")


driver.execute_script("window.promptResponse=prompt('Enter smth','smth')")
a = driver.execute_script("var win = this.browserbot.getUserWindow(); return win.promptResponse")


def main():

driver =         webdriver.Chrome(executable_path=r'C:\Users\Michelle\Downloads\chromedriver.exe')


    driver.execute_script("window.promptResponse=prompt('Enter smth','smth')")
    Itemvar1 = driver.execute_script("var win = this.browserbot.getUserWindow(); return win.promptResponse")

    input_element = driver.find_element_by_id("gh-ac")

    items = driver.find_elements_by_css_selector('.srp-results .s-item .s-item__title')
    prices = driver.find_elements_by_css_selector('.srp-results .s-item .s-item__price')
    auctions = driver.find_elements_by_css_selector('.srp-results .s-item .s-item__purchase-options')

    print("# Items: %d" % len(items))
    print("# Prices: %d" % len(prices))

    num_page_items = len(items)
    for i in range(num_page_items):

        print(items[i].text + " : " + prices[i].text + " " + auctions[i].text )


if __name__ == '__main__':

this code is good but in between the two __ the code that is there does not work properly as i gathered it from old forum point being I'm pretty sure it does not wait till the two java commands are done before continuing to rest which makes the code break can someone help me fix this or come up with an alternative

1 Answer 1


If you use Python input getter, it should work:

text = input("prompt")

OBS: You probably shouldn't relay on user interaction on an automated checking script - the goal of it is exactly this: Perform the checking without wait for user evaluation during its execution.

  • its not exactly what i'm looking for but it will work i was trying to get it to prompt for info on chrome and not python Dec 11, 2018 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.