0

I'm trying to get forms filled out on this auction website. Right now I need to figure out how to select the option on a hover-menu. I tried looking at other questions here but they all had XPATH or CSS as ways for identifying the sub menu option. I can't inspect the option with my browser and I would appreciate any insights!

Menu and SubMenu Screenshot

What the code for for the Assignment button:

HTML code from Google Chrome

HTML 2 - when I hover over "Add Auction Assignment" it seems like it makes something called a javascript pop up, but I don't know.

Below is the code I have so far and the approach I attempted. It does find the assignment button and it does hover over it but it always times out.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.webdriver import ActionChains
from selenium.webdriver.support.ui import Select

browser = webdriver.Chrome("C:\Program Files\chromedriver_win32/chromedriver.exe")

actions = ActionChains(browser)

#Go to the desired website
browser.get("http://www.autoims.com/external/index.jsp")

usrname_box = browser.find_element_by_xpath('//*[@id="loginUsername"]')
pw_box =  browser.find_element_by_xpath('//*[@id="password"]')
login_button =  browser.find_element_by_xpath('//*[@id="submit"]')

#login process here

wait = WebDriverWait(browser, 10)

for vin in df['VIN']:
    assignments = wait.until(EC.visibility_of_element_located((By.XPATH, '//*[@id="_img0"]')))
    ActionChains(browser).move_to_element(assignments).perform()

    add_assignment = wait.until(EC.visibility_of_element_located((By.XPATH, "  HELP :(  "))) #always fails
    ActionChains(browser).move_to_element(add_assignment).click().perform()
6
  • Can you find the text Add Auction Assignment in the markup? Commented Sep 9, 2017 at 3:35
  • I dont' know. What I see is the src for the image change when I hover over the assignments. src = "/images/menu/internal/btn_assingments.jpg" CHANGES TO ---> src = "/images/menu/internal/btn_assignments_on.jpg" "" Commented Sep 9, 2017 at 20:54
  • Are you confirming that when you view source for the page and search for the text it isn't present? Commented Sep 10, 2017 at 1:57
  • I couldn't figure it out. I just copied the link from the button and had the webdriver get the url. Commented Sep 13, 2017 at 18:33
  • Hi Saul, we need to find out the html code of the sub menu, otherwise we can't know how to compose the css locator or xpath for the sub ment, could you open the site in chrome and navigate to the page which can show that sub menu, open chrome devtool, choose the 'Elements' tab, mouse over on the 'AssignMents' to make the sub menu show out, back to the 'Elements' tab, click on anywhere within the tab, press Ctrl+F to open the search box (the box will appear at bottom), type 'Add Auction Assignment' in search box, to see anything can be found Commented Sep 13, 2017 at 23:59

1 Answer 1

1

did you try to find the html code of sub menu from the end of page souce, for some JQuery navbar plugin, it append the html code of sub menu to the end of body tag.

you can scroll down to the end of page source firstly, then hover on the Assignment menu, meanwhile watch any new html code appended or any html code change.

only when we see the html code of sub menu, we can know how to locator it in script.

Sign up to request clarification or add additional context in comments.

4 Comments

The code for the javascript pop up (modal?) is probably somewhere near the bottom of the DOM with its display set to 'none' or 'hidden' - as @yong mentioned, try searching for it here. Also, if you hover over 'Add Auction Assignment' then start up Chrome Dev Tools and click the element locator, you should still be able to inspect the javascript pop up.
Not sure if this is it but I I see: <a name "mM1" id = "mmlink0" href = "javascript:popup('assignments')" ... that and the img src for the tab changes. Sorry for not having more details but I'm pretty lost here.
is there any can shared account? if so I can logon to get more detail
I couldn't figure it out. I just copied the link from the button and had the webdriver get the url.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.