Skip to content
← Back to Community
I need help getting my code to type to a new tab
Profile icon
Atomic-Gamming

I am trying to make it open kahoot.it in a new tab but it will not type into the new tab and only the first tab. Can you guys help me?
Also, it is giving me this error:

Traceback (most recent call last): File "main.py", line 28, in <module> driver.switch_to_window(driver.window_handles[1]) AttributeError: 'Browser' object has no attribute 'switch_to_window' exit status 1
Answered by ArjunSS1 [earned 5 cycles]
View Answer
Voters
Profile icon
Ana-SofaSofa3
Profile icon
PXY
Profile icon
Atomic-Gamming
Comments
hotnewtop
Profile icon
ArjunSS1

Your currently using a selenium webdriver function to switch windows. I was unable to find a switch_to_window() in webbot documentation but I found a switch_to_tab() so either switch to webdriver or switch tabs

Profile icon
Atomic-Gamming

@ArjunSS1 now it gives me this error:

Traceback (most recent call last): File "main.py", line 28, in <module> switch_to_tab() NameError: name 'switch_to_tab' is not defined exit status 1
Profile icon
ArjunSS1

@JamesGordon1 Sorry for not being precise its driver.switch_to_tab(x)

Profile icon
Atomic-Gamming

@ArjunSS1 now it says it that 'x' is undefined

Profile icon
Atomic-Gamming

@ArjunSS1 nvm I got what 'x' means.

Profile icon
SamuelPKuld

Have you attempted making a .py file on your desktop and running it from there? Since repl.it isn't a hardwired operating system for your machine, there is a possibility that the repl.it work-space can't access your browser, as it is not the primary OS for your system. So try making a .py file with the same contents as here and run it.

Profile icon
Atomic-Gamming

@TheFlooBearer I cant its a school computer (plus I don't know how)
Edit: its a chromebook