Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Selenium click on popup button???
#1
Hi everyone!
I have been searching for this problem for a week but i couldnt find anything about it.
The problem is this. After i entered the instagram there is a popup so i want to click Not Now button but i couldnt do with xpath or the other things. Can someone help ?? Here you can click the image that shows the problem İmage
Quote
#2
use XPath, and click()
example:
        search_box = browser.find_element(By.XPATH, '//*[@id="quickSearch_BusinessName"]')
        search_box.send_keys(searchitem)
        browser.find_element(By.XPATH, '//*[@id="btn_Search"]').click()
        time.sleep(2)
In Firefox, You can get the XPath of the button, by bringing up site, right click on button and select Inspect Element-->Copy-->XPath
Quote
#3
Thank you for your message. I've used Chrome Driver, so i use xpath but it is not working, not clicking.
I have tried it but i couldnt do. Can you explain it obviously.
search_box = browser.find_element(By.XPATH, 'xpath way?')
search_box.send_keys(searchitem ???)
browser.find_element(By.XPATH, '//*[@id="Not Now"]').click()
time.sleep(2)
Quote
#4
Actually, I posted the wrong example, should have been and it uses css selector:
page_button_css = 
    'mainContent > table:nth-child(5) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(3) > font:nth-child(1) > a:nth-child(1)'
next_page = self.browser.find_element(By.PARTIAL_LINK_TEXT, 'Next 250')
ActionChains(self.browser).move_to_element(next_page)
next_page.click()
the imports needed are:
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By
Quote
#5
Thank you :) I solve that like this. I have imported these libraries.
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
These xpaths are the same xpath and "Not Now" is the button which one i wanted to click.
search_box = browser.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[3]/button[2]')
search_box.send_keys("Not Now")
browser.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[3]/button[2]').click()
So i solve this problem with this. :) Thank you for your help! :)
Quote
#6
These two lines from your solution seems redundant to me. Sending keys to a button element does nothing
search_box = browser.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[3]/button[2]')
search_box.send_keys("Not Now")
Quote
#7
Yes you are right i tried it a few min. before. Those lines are redundant. :) Thank you for your help and information.
Quote
#8
(Jan-20-2019, 06:31 PM)GuJu Wrote: Thank you :) I solve that like this. I have imported these libraries.
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By 
These xpaths are the same xpath and "Not Now" is the button which one i wanted to click.
search_box = browser.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[3]/button[2]') search_box.send_keys("Not Now") browser.find_element(By.XPATH, '/html/body/div[2]/div/div/div/div[3]/button[2]').click() 
So i solve this problem with this. :) Thank you for your help! :)



thank you...this helped me to solve my issue
metulburr likes this post
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Contact form button click action Man_from_India 1 242 Feb-01-2020, 06:21 PM
Last Post: snippsat
  Error clicking button with selenium julio2000 4 462 Jan-06-2020, 10:59 AM
Last Post: julio2000
  HOWTO? Login DSL Modem with Python Requests: need Click "Apply" Button Webtest 4 3,459 Aug-20-2019, 04:03 PM
Last Post: johnmina
  Python Selenium .click() Loads Error - Works Manually.- Events not Triggered NSearch 24 1,904 Aug-14-2019, 02:23 PM
Last Post: NSearch
  How to trigger click event on Button without ID/Name gahhon 7 1,726 Feb-10-2019, 03:06 PM
Last Post: gahhon
  Click Element if displayed using Selenium and Python giaco__mar 1 1,169 Dec-27-2018, 06:19 PM
Last Post: metulburr
  how to click javascript button hcyeap 3 1,887 Aug-16-2018, 01:26 PM
Last Post: metulburr
  Selenium xpath finding gif to click fyec 1 1,157 Jul-27-2018, 05:20 PM
Last Post: snippsat
  Click a button to get next page ian 7 23,085 Apr-15-2018, 10:05 PM
Last Post: snippsat
  Click on unusual class button using mechanize Ask Question Coto 1 1,229 Feb-18-2018, 07:27 AM
Last Post: metulburr

Forum Jump:


Users browsing this thread: 1 Guest(s)