yan pang
yan pang

Reputation: 41

'object is not callable' error while using selenium (python)

I used the browser.switch_to.alert().accept() to handle a javascript alert popup. But I got an error like this:

TypeError: 'Alert' object is not callable

How can I fix this problem?

Upvotes: 4

Views: 14808

Answers (1)

Reinout van Rees
Reinout van Rees

Reputation: 13634

Alert object is not callable? Then you should stop calling it. So modify

browser.switch_to.alert().accept()

to

browser.switch_to.alert.accept()

(So remove the () after alert).

Upvotes: 20

Related Questions