티스토리 뷰

Alt vs Title element

 

Alt element in HTML, the statement in Alt element appear if image not loaded. 

<img id="Lu_man_DG_ctl03_imgCompanyStatus" src="../images/Green1-1.gif"
alt="This source is currently certified." align="middle" style="border-width:0px;">

 

Title element in HTML, the statement in Title element appear when your mouse is located on image.

 


DeprecationWarning

 

You can see below warning mention even though your code is running well.

 

DeprecationWarning: find_elements_by_* commands are deprecated. Please use find_elements() instead

 

The reason why this warning load is the code series 'find_element_by~' will be obsolete.

In order to notice to users in advance, terminal shows this warning if you use 'find_element_by~'

 

You can replace below code

partlist = driver.find_element_by_id("Lu_gov_DG_ctl03_btnGovPartNo")
#Old version 

partlist = driver.find_element(By.ID, "Lu_gov_DG_ctl03_btnGovPartNo")
#New version

*Please keep in mind that , in new version, you should all capital letters for element. (Not id or Id. ID is correct).

 

 


HTML 텍스트를 출력함에 있어서 alt 요소에도 텍스트가 있길래 혹시 출력되나 해서 출력해보니, alt 내에 있는 구문은 .text로 출력이 안되더라.

그 이유를 찾아보니 alt는 이미지가 엑박이 뜨면 이 그림이 뭔지 출력하는 일종의 안전장치? (+ 시각장애인을 위한) 같은 것이기에 이미지가 뜨지 않을때 발현되는 것이다 보니 텍스트로 따로 따와서 출력하는게 안되는 것 같더라.. 그래도 방법이 있지 않을까 싶다. 한 번 더 찾아봐야지.

 

<img id="Lu_man_DG_ctl03_imgCompanyStatus" src="../images/Green1-1.gif"
alt="This source is currently certified." align="middle" style="border-width:0px;">

-> Image Green이 엑박 뜰 경우, This source is currently certifed 를 표시해준다.

 

 

 

DeprecationWarning

 

코드는 정상 작동하는데 자꾸 저런 warning 문구를 만나게 된 경우가 있을 것이다. 그 이유는 find_element_by_~ 라는 구문이 곧 사장될 구문이기 때문에 터미널에서 미리 공지해주는 것임!

 

그러므로 앞으로는 아래 처럼 신버전으로 쓰자.

partlist = driver.find_element_by_id("Lu_gov_DG_ctl03_btnGovPartNo")
#구버전, 아직 사용은 가능하나 미래에 사장될 구문이므로 계속해서 경고문 출력함

partlist = driver.find_element(By.ID, "Lu_gov_DG_ctl03_btnGovPartNo")
#신버전, 경고문이 뜨지 않는다. 주의할 점은 element를 꼭 대문자로 써야 하며, By도 by도 BY도 아닌 By로 써야한다.

여기서 주의 할 점은 꼭 Element를 대문자로 써야 한다는 점!

공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/05   »
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
글 보관함