selenium

How to click the center of the canvas in Java Selenium Driver?

纵饮孤独 提交于 2021-01-28 11:28:39
问题 I'm trying to write the code to click a canvas center in the web page. Here is the code below: private static void clickCanvasCenter() { WebElement we = driver.findElement(By.tagName("canvas")); int x = we.getSize().width/2; int y = we.getSize().height/2; Actions builder = new Actions(driver).moveToElement(new WebDriverWait(driver,20) .until(ExpectedConditions.elementToBeClickable(we))); System.out.println("width:" + x + "\theight:" + y); builder.click().build().perform(); System.out.println(

Is TestNG Not Possible To Repeat Class?

柔情痞子 提交于 2021-01-28 11:24:30
问题 I'm trying to build a data driven automation test with TestNG as main framework and apache-poi as data source (using .xlsx file), I'll to use this for selenium purposes. This is example the selected scenario from excel file: See image detail here It can be chosen randomly, according to the user who uses it. The pattern can be purchase all, consume all, or mix. And the expectations run in the order chosen. So far this is the code I've created: Master class public class Master { public static

Webscraping data from an interactive graph from a website

柔情痞子 提交于 2021-01-28 11:17:22
问题 I am trying to access data from the graph from the below mentioned website https://www.prisjakt.nu/produkt.php?pu=5183925 I am able to access and extract data from the table below the graph. But i am unable to fetch data from the graph which is being called dynamically using a javascript? I knew that using beautifulsoup api is not sufficient here. I tried going around in console of the webpage to see the contents of the graph but i am not successful. I also tried to look into view-source

How to line break in WhatsApp with Selenium when sending a message?

十年热恋 提交于 2021-01-28 11:09:12
问题 Message sending function: template = { 'other': 'Text.' 'More Text.' 'Much more text.' } def send_message(driver, answer): driver.find_element_by_xpath('XPATH').click() action = ActionChains(driver) action.send_keys(answer) action.send_keys(Keys.RETURN) action.perform() Depending on the received message from the template , the necessary answer is taken and passed to send_message() as the answer argument. If you send the message as is, then in WhatsApp it comes in one line: Text.More text.Much

How to line break in WhatsApp with Selenium when sending a message?

耗尽温柔 提交于 2021-01-28 11:08:26
问题 Message sending function: template = { 'other': 'Text.' 'More Text.' 'Much more text.' } def send_message(driver, answer): driver.find_element_by_xpath('XPATH').click() action = ActionChains(driver) action.send_keys(answer) action.send_keys(Keys.RETURN) action.perform() Depending on the received message from the template , the necessary answer is taken and passed to send_message() as the answer argument. If you send the message as is, then in WhatsApp it comes in one line: Text.More text.Much

Chrome out of memory in selenium - no error thrown [duplicate]

六月ゝ 毕业季﹏ 提交于 2021-01-28 10:50:25
问题 This question already has answers here : How to set memory limit for OOM Killer for chrome? (1 answer) java.lang.OutOfMemoryError: unable to create new native thread error using ChromeDriver and Chrome through Selenium in Spring boot (3 answers) Closed 5 months ago . I have a selenium script using Chrome that runs for a very long time. Eventually, the browser runs out of memory, and I get the "Error code: Out of Memory" page. The problem is, no error is thrown in Python, so I don't know how

Storing information from td tags with a specific width, in python

喜你入骨 提交于 2021-01-28 10:25:45
问题 I am trying to store all the information from the td tags that have width="82" or maybe there is a more efficient method. <a name="AAKER"> </a> <table border="" width="100%" cellpadding="5"><tbody><tr><td bgcolor="#FFFFFF"><b>AAKER</b> <small>(<a href="http://google.com">Soundex A260</a>) — <i>See also</i> <a href="http://google.com">ACKER</a>, <a href="http://google.com">KEAR</a>, <a href="http://google.com">TAAKE</a>. </small> </td></tr></tbody></table><br clear="all"> <table align="left"

Storing information from td tags with a specific width, in python

时光总嘲笑我的痴心妄想 提交于 2021-01-28 10:24:15
问题 I am trying to store all the information from the td tags that have width="82" or maybe there is a more efficient method. <a name="AAKER"> </a> <table border="" width="100%" cellpadding="5"><tbody><tr><td bgcolor="#FFFFFF"><b>AAKER</b> <small>(<a href="http://google.com">Soundex A260</a>) — <i>See also</i> <a href="http://google.com">ACKER</a>, <a href="http://google.com">KEAR</a>, <a href="http://google.com">TAAKE</a>. </small> </td></tr></tbody></table><br clear="all"> <table align="left"

How to click on the radio button through the element ID attribute using Selenium and C#

倾然丶 夕夏残阳落幕 提交于 2021-01-28 09:50:14
问题 I am trying to select a radio button and input element, it has an id of group and value of In_Group . There are 4 different radio buttons with the same id but different values hence I am trying to select the correct one i am looking for. <input class="custom-radio" id="group" name="group" type="radio" value="In_Group"> I tried something like this: driver.FindElement(By.XPath("//*[contains(@id='group' and @value='In_Group')]")) But the element is not found could someone help me out 回答1: To

Unable to locate element under dynamic-comp

独自空忆成欢 提交于 2021-01-28 09:22:58
问题 There are dozens of questions here on SO with a title very similar to this one - but most of them seem related to some iFrame, which prevents Selenium to access the intended tag, node, or whatever. In my case, I'm trying to access this site. All I want is to read the data on a table - it is easy to identify, given there it is inside a div with a very particular ID. The table is also simple to read. Despite that, there is this dynamic-comp tag, which seems to be my stumbling block - I can