dom

How to get the value of an element in Python + Selenium?

感情迁移 提交于 2021-02-07 03:01:48
问题 I have got this HTML element in my Python (3.6.3) code (as Selenium webelement of course): <span class="ocenaCzastkowa masterTooltip" style="color:#000000;" alt="Kod: pd1<br/>Opis: praca domowa<br/>Waga: 2,00<br/>Data: 12.09.2017<br/>Nauczyciel: (NAME CENSORED)">5</span> and I want to get the value at the end (which is 5 in this case) and I have got no idea how to get it. obviously I can't use webelement.get_attribute() cause I don't know the name of the attribute. 回答1: Try the following code

How to get the value of an element in Python + Selenium?

你说的曾经没有我的故事 提交于 2021-02-07 03:01:22
问题 I have got this HTML element in my Python (3.6.3) code (as Selenium webelement of course): <span class="ocenaCzastkowa masterTooltip" style="color:#000000;" alt="Kod: pd1<br/>Opis: praca domowa<br/>Waga: 2,00<br/>Data: 12.09.2017<br/>Nauczyciel: (NAME CENSORED)">5</span> and I want to get the value at the end (which is 5 in this case) and I have got no idea how to get it. obviously I can't use webelement.get_attribute() cause I don't know the name of the attribute. 回答1: Try the following code

Manipulate DOM in Electron

﹥>﹥吖頭↗ 提交于 2021-02-06 14:00:22
问题 What is the best way to manipulate DOM within an electron app? I made some tutorials from docs using ipc and webcontents with no luck My app is so simple, I just want to use the web like a console and showing messages (render proc) comming from the results of several sync functions (main proc) I updated the question with real code. I'm going to put another code, more simple to see and more simple to test (I think), is real code and works (but not like I want) When I launch electron only

Manipulate DOM in Electron

﹥>﹥吖頭↗ 提交于 2021-02-06 13:59:45
问题 What is the best way to manipulate DOM within an electron app? I made some tutorials from docs using ipc and webcontents with no luck My app is so simple, I just want to use the web like a console and showing messages (render proc) comming from the results of several sync functions (main proc) I updated the question with real code. I'm going to put another code, more simple to see and more simple to test (I think), is real code and works (but not like I want) When I launch electron only

React .createClass() scroll to ref: scrollIntoView not a function

天大地大妈咪最大 提交于 2021-02-06 11:26:13
问题 I'm having trouble figuring out what's wrong when I'm trying to scroll to a "ref". I've been searching like mad and found urls which make complete sense, but it won't work in my scenario. https://github.com/yannickcr/eslint-plugin-react/issues/678 http://codepen.io/takatama/pen/mVvbqx I have an app using react 15.4.2 along with react-router 3.0.0. I have a route to a component that takes an optional route parameter and am trying to use that to scroll to the element on componentDidUpdate(). I

React .createClass() scroll to ref: scrollIntoView not a function

好久不见. 提交于 2021-02-06 11:24:22
问题 I'm having trouble figuring out what's wrong when I'm trying to scroll to a "ref". I've been searching like mad and found urls which make complete sense, but it won't work in my scenario. https://github.com/yannickcr/eslint-plugin-react/issues/678 http://codepen.io/takatama/pen/mVvbqx I have an app using react 15.4.2 along with react-router 3.0.0. I have a route to a component that takes an optional route parameter and am trying to use that to scroll to the element on componentDidUpdate(). I

document.head v. document.getElementsByTagName(“head”)[0]

久未见 提交于 2021-02-05 20:23:55
问题 What is the difference between using document.head and using document.getElementsByTagName("head")[0] ? Tests I ran showed that they both take about a millisecond. I have also seen document.head||document.getElementsByTagName("head")[0]; which would have led me to believe that document.head is faster and the other is more more compatible, except that the tests I did disproved this. And if one is more compatible, why use the other as well? Update: My tests were wrong, as some have pointed out.

.prop() vs .attr()

拈花ヽ惹草 提交于 2021-02-05 12:32:47
问题 So jQuery 1.6 has the new function prop(). $(selector).click(function(){ //instead of: this.getAttribute('style'); //do i use: $(this).prop('style'); //or: $(this).attr('style'); }) or in this case do they do the same thing? And if I do have to switch to using prop() , all the old attr() calls will break if i switch to 1.6? UPDATE selector = '#id' $(selector).click(function() { //instead of: var getAtt = this.getAttribute('style'); //do i use: var thisProp = $(this).prop('style'); //or: var

Why does `document.getElementById(“#sideNav”)` not find my element?

a 夏天 提交于 2021-02-05 12:28:34
问题 Why is this code throwing “ TypeError : Cannot read property ' style ' of null ” ? function openNav() { document.getElementById("#sideNav").style.width = "250px"; } function closeNav() { document.getElementById("#sideNav").style.width = "0"; } <div class="sidenav" id="sideNav"> <a href="javascript:void(0)" class="closenav" onclick="closeNav()">×</a> <a href="#">Home</a> <a href="#">Listing</a> <a href="#">About Us</a> <a href="#">Contact</a> </div> <span onclick="openNav()">OPEN</span> <div

Why does jQuery or a DOM method such as getElementById not find the element?

十年热恋 提交于 2021-02-05 12:21:02
问题 What are the possible reasons for document.getElementById , $("#id") or any other DOM method / jQuery selector not finding the elements? Example problems include: jQuery silently failing to bind an event handler jQuery "getter" methods ( .val() , .html() , .text() ) returning undefined A standard DOM method returning null resulting in any of several errors: Uncaught TypeError: Cannot set property '...' of null Uncaught TypeError: Cannot read property '...' of null The most common forms are: