selenium-webdriver

Scrapy with Selenium does not detect HTML element loaded dynamically

纵然是瞬间 提交于 2020-01-25 09:30:09
问题 I am using Scrapy with Selenium to scrape content from this page: https://nikmikk.itch.io/door-knocker In it, there is a table under the div with class .game_info_panel_widget , where the first row Published 62 days ago seems to be loaded dynamically. I have try fetching the page as Scrapy sees but cannot find that row in the html. scrapy fetch --nolog https://nikmikk.itch.io/door-knocker > test.html Here is what I see in test.html , the first table row is the Status, not the Published row

How to select elements with the same css selector

 ̄綄美尐妖づ 提交于 2020-01-25 09:28:04
问题 I have numerous elements in my ui tests that have the same css selector name but the issue I'm have is how to select each of them separately. I recall there was a way to add [1],[2] after each of them but i cant seem to make it work. I'm currently using "[data-qa-inning-value]"[1], "[data-qa-inning-value]"[2], etc but it is not picking it up, any help? It currently isn't picking anything up but I do remember there was a way to do it but I just cant find it in my notes 回答1: Ideally, you should

Safari browser is not identifying the button based on cssSelector or xpath

≡放荡痞女 提交于 2020-01-25 09:03:22
问题 My tests are Failing while running the in the Safari browser pointed to Browserstack cloud env. Could anyone please advise on how to fix the problem here. When a button is clicked, system displays a Modal Overlay and the "Show results" button is displaying inside the Modal overlay I have tried the test with xpath and By.cssSelector() way to grab the button, but still not good. WebElement showResultButton = driverSafari.findElement(By.cssSelector("div.modal-content .app-modal-footer.modal

Selenium not wait to element to be clickable

十年热恋 提交于 2020-01-25 08:54:06
问题 Hey All I have an issue that I am trying to resolve for long time. The problem is that I want selenium to wait for element to be clickable, after a message displayed on screen. The element ID is: header-account The timeout I sent to method is:15500 I set the Implicit wait to: IMPLICIT_WAITE = 35; As you can see selenium not waits for a second This is my main: BasePage.waitInvisabilityOfElementByXpath("//div[@class='ant-notification ant-notification-topRight']"); System.out.println("\n\n

Selenium Actions dragAndDrop unexpectedly navigates to google search page

核能气质少年 提交于 2020-01-25 07:24:28
问题 I've been trying to practice with drag and drop tests on following page https://www.seleniumeasy.com/test/drag-and-drop-demo.html Here is the code of PageObject class with only one method, which drags and drops element of the list to the dropzone: public class DragAndDropDemoPage extends Page { public DragAndDropDemoPage(WebDriver driver) { super(driver); navigateTo(); } @Override public void navigateTo() { driver.get(Urls.DRAG_AND_DROP_PAGE_URL); } public void dragAndDropElementWithIndex(int

Python, Selenium, download all MIME types

雨燕双飞 提交于 2020-01-25 05:31:37
问题 I am trying to download some files using selenium webdriver for Firefox. How to set option browser.helperApps.neverAsk for any MIME type? Now this option working only for application/pdf (in my script): #selenium profile profile = webdriver.FirefoxProfile() profile.set_preference('browser.download.dir', download_dir) profile.set_preference('browser.download.folderList', 2) profile.set_preference('browser.download.manager.showWhenStarting', False) profile.set_preference('browser.helperApps

Switching back to parent frame after it's no longer in DOM in Selenium

♀尐吖头ヾ 提交于 2020-01-25 04:36:06
问题 I have the following page <body> <iframe id="outer_frame"> <iframe id="search_button_frame"> <button id="search_button"></button> </iframe> </iframe> </body> Now after I click on the search_button the two frames outer_frame and search_button_frame are no longer in DOM and instead the page becomes like this <body> <iframe id="form_frame"> ... </iframe> </body> I'm trying to go to the search_button then get out of the frames into the main page, and then switching to the form_frame using this:

Not able to select a list item in an unordered list using selenium python

▼魔方 西西 提交于 2020-01-25 03:56:08
问题 I need to select a list item in an unordered list using selenium python. HTML: <div class="ms-drop bottom" style="display: block;"> <ul style="max-height: 400px;"> <li class="ms-select-all"> <label><input type="checkbox" data-name="selectAlls_osVer"> [Select all] </label> </li> <li class="" style="false"> <label class=""><input type="checkbox" data-name="selectItems_osVer" value="KK"> <span style=""> KK </span> </label> </li> <li class="" style="false"> <label class=""><input type="checkbox"

What does contains(., 'some text') refers to within xpath used in Selenium

梦想与她 提交于 2020-01-25 02:47:47
问题 I am new to selenium coding, and I am seeing several xpaths that contain (.,'followed by something') what does the ., refer to? 回答1: The . character within the xpath is the short form of text() As an example if an WebElement is represented within the DOM Tree as: <span>Use this payment method</span> Effective Locator Strategies will be: xpath 1 : //span[text()='Use this payment method'] xpath 2 : //span[contains(., 'Use this payment method')] Reference You can find a couple of relevant

How to enable javascript in selenium webdriver Chrome using python

六眼飞鱼酱① 提交于 2020-01-25 00:48:05
问题 I am trying to open https://www.guidestar.org/ using selenium webdriver but it is able to detect I am a bot. The email I received says that javascript was not enabled so they were blocking my IP address. Can anyone suggest a code to enable javascripts user_agent = 'Chrome/73.0.3683.86' username = os.getenv("USERNAME") userProfile = "C:\\Users\\" + username + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default" options = webdriver.ChromeOptions() options.add_argument(f'user-agent={user_agent