selenium-webdriver

New Microsoft Edge and Selenium web driver

偶尔善良 提交于 2021-02-11 14:48:05
问题 I am a student and I started writing my first scripts using Ruby, Capybara, rspec and selenium web driver. I need to run my script in all modern browsers, but I'm facing some problems to run my script at the new Microsoft browser Edge. My rspec config is something like this: Capybara.configure do |config| config.default_driver = :selenium #This line is for run tests using Mozilla Firefox #config.default_driver = :selenium_chrome #This line is for run tests using Google Chrome end Edge is just

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element : what should i do

一个人想着一个人 提交于 2021-02-11 14:46:25
问题 I am web crwaling but I keep getting troubles... selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element there is a error in click = '//*[@id="pagerTagAnchor' + str(j) + '"]' driver.find_element_by_xpath(click).click() what should i do? import requests from bs4 import BeautifulSoup from selenium import webdriver f = open('movie.txt', 'w', encoding='utf-8') options = webdriver.ChromeOptions() options.add_argument('headless') options.add_argument(

How to do scheduling task in django and selenium combine project?

不羁的心 提交于 2021-02-11 14:34:13
问题 I am working on a web app project in Django with selenium where per one user there is one chrome browser open also chrome profile directory per user and chrome stay alive 24/7. Where the user can send msg or schedule msg. My problem is how can I send a schedule msg ? The following problem I am facing while working on my project: How to open a browser that already associated with my user because I already have user chrome profile directory per user and chrome is always open. I want that user

Selenium Basic VBA focus on new tab that is opened by Click

偶尔善良 提交于 2021-02-11 14:34:06
问题 I'm working on the Selenium Basic Wrapper for Excel VBA, but upon clicking a button that opens a new tab, I am unable to get the selenium web-driver to switch focus onto the new tab that is opened, and to close the original tab.. Believe this should be achievable using the Java Selenium, but is there any way to do it through the Selenium Basic wrapper on excel VBA? Have tried using bot.switchtopreviouswindow/nextwindow to no avail, Selenium does not even seem to detect the new tab/window

Website denies get request using Selenium

假装没事ソ 提交于 2021-02-11 14:24:07
问题 I am trying to use selenium in order to automate for login into a website https://afghanbids.com/ but when I run my python program, the browser loads a page which says access denied. You may please see the screen shot below. My code: driver = webdriver.Chrome(executable_path="chromedriver.exe") driver.get("https://afghanbids.com/") It shows that: How can I make the request so that the target website does not deny my request? 回答1: I took your code, added a few tweaks and encountered the access

Selenium webdriver :org.openqa.selenium.InvalidElementStateException: Element is disabled and so may not be used for actions

巧了我就是萌 提交于 2021-02-11 14:21:51
问题 I am getting this error while trying to write to simple code in selenium webdriver to enter a value in google search page and enter. Following is my code -: WebDriver driver = new FirefoxDriver(profile); driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS); driver.get("http://www.google.com"); WebElement element=driver.findElement(By.xpath("//input[@id='gs_htif0']")); boolean b = element.isEnabled(); if (b){ System.out.println("Enabled"); } element.sendKeys("Test Automation");

How can I identify the element containing the link to my linkedin profile after I logged in using selenium.webdriver?

廉价感情. 提交于 2021-02-11 14:19:35
问题 I have written a script (python) to login to my LinkedIn page (feed) and then I want the script to take me to my profile page. But I cannot capture the element with the link (it keeps changing its id with every restart of the browser). Obviously, I know the link but I would like for the script to be able to capture it. This is the code I have so far: import parameters from time import sleep from selenium import webdriver driver = webdriver.Chrome('/Users/uglyr/chromedriver') driver.get('https

How to run a single test case (method) instead of whole test suite (class) using Selenium/TestNG/Maven

元气小坏坏 提交于 2021-02-11 14:12:01
问题 So basically I am wondering how could I run a specific test case (a method) instead of running a whole class. I am running tests using a combination of Selenium/Maven/TestNG. My current testing setup looks something like this: simplified command to run tests: mvn test -DtestSuiteName="test" contents of test.xml used in the command above: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Selenium Testng Template"> <test name=

How to run a single test case (method) instead of whole test suite (class) using Selenium/TestNG/Maven

懵懂的女人 提交于 2021-02-11 14:11:45
问题 So basically I am wondering how could I run a specific test case (a method) instead of running a whole class. I am running tests using a combination of Selenium/Maven/TestNG. My current testing setup looks something like this: simplified command to run tests: mvn test -DtestSuiteName="test" contents of test.xml used in the command above: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="Selenium Testng Template"> <test name=

How to get Json response by selenium webdriver using Java?

落花浮王杯 提交于 2021-02-11 13:58:59
问题 I'm trying to get Json response by selenium webdriver. How to get it as a Json format. Currently what I get is a String format. Here is what I'm trying to get: {"id":377,"text":"Playing Sudoku is fun!"} <pre style="word-wrap: break-word; white-space: pre-wrap;">{"id":377,"text":"Playing Sudoku is fun!"}</pre> Here is my code: import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class GameTestSelenuim { public static void