2

I'm trying to run multiple drivers through multi-threading using Selenium. However I'm experiencing a weird problem, when I have more than 5 drivers open for example, the code seems to execute in the background in the sense that it navigates over to the webpages and clicks elements etc. But the program does not go through any print statements nor does it close at the end until I click on the chrome window and it is "viewable" on the screen. I also noticed if I have any other application (say Sublime Text) over the chrome instance than it's the same problem.

I was able to work this before even when I have 50 different instances running at the same time but not sure what happened that it's doing this. Any help would be appreciated and if I can provide any other details.

The following is what I am using in the options to create my driver:

PATH = self.webDriverPath
options = webdriver.ChromeOptions()
options.add_experimental_option("excludeSwitches", ["enable-logging"])
options.add_experimental_option("detach", True)
options.add_argument("--start-maximized")
self.driver = webdriver.Chrome(executable_path = PATH, options = options)

I'm also getting the following message:

DevTools listening on ws://127.0.0.1:62963/devtools/browser/11b5a873-fe5a-4831-878f-a9c0225c062d [504:2752:1119/191918.546:ERROR:device_event_log_impl.cc(211)] [19:19:18.546] USB: usb_device_handle_win.cc:1020 Failed to read descriptor from node connection: A device attached to the system is not functioning. (0x1F)

NOTE:

I hovered my mouse over the chrome icon that pops up and I can see the Title changing when going to a webpage for example. But the preview stays blank. Before I was able to see the preview of what the page looks like without actually opening up the window.

bad_coder
  • 11,289
  • 20
  • 44
  • 72
Dylan
  • 31
  • 3
  • 1
    webdriver is not thread safe: https://stackoverflow.com/a/30828102/1387701 – DMart Nov 20 '20 at 03:02
  • 1
    I am using multiple drivers for each chrome instance. However I have located the problem. On the final submit button I am using WebDriverWait and the element_to_be_clickable method but unless i open up the instance and it's seen on screen the button never becomes clickable for some reason and just stays put. If I use presence_of_element_located method it works but the code executes the click command on the element before the button is even clickable – Dylan Nov 20 '20 at 15:56
  • maybe post the html of the element. you're trying to click. Might make the issue more obvious. – DMart Nov 20 '20 at 16:02
  • Do you recieve a time out exception or another? – DMart Nov 20 '20 at 16:03
  • Yes I get a timeout exception. Basically unless the window opens up then nothing happens. Same issue when trying to locate element by xpath method is used. It's weird because this wasn't happening before – Dylan Nov 20 '20 at 19:07

0 Answers0